Class: Inferno::Repositories::Messages

Inherits:
Repository
  • Object
show all
Defined in:
lib/inferno/repositories/messages.rb

Defined Under Namespace

Classes: Model

Instance Method Summary collapse

Methods inherited from Repository

#add_non_db_entities, #build_entity, #create, db, #db_params, #entity_class, #entity_class_name, #find, #handle_non_db_params, #non_db_params, table_name, #update

Instance Method Details

#messages_for_result(result_id) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/inferno/repositories/messages.rb', line 4

def messages_for_result(result_id)
  self.class::Model
    .order(:index)
    .where(result_id:)
    .to_a
    .map!(&:to_json_data)
    .each(&:deep_symbolize_keys!)
    .map! { |result| build_entity(result) }
end