diff --git a/app/models/concerns/media_object_behavior.rb b/app/models/concerns/media_object_behavior.rb index 26d03f907f..498522fbae 100644 --- a/app/models/concerns/media_object_behavior.rb +++ b/app/models/concerns/media_object_behavior.rb @@ -19,6 +19,7 @@ def as_json(options={}) id: id, title: title, collection: collection.name, + collection_id: collection.id, unit: collection.unit, main_contributors: creator, publication_date: date_created, diff --git a/spec/controllers/media_objects_controller_spec.rb b/spec/controllers/media_objects_controller_spec.rb index 92d03f4069..74ee109890 100644 --- a/spec/controllers/media_objects_controller_spec.rb +++ b/spec/controllers/media_objects_controller_spec.rb @@ -1193,6 +1193,7 @@ expect(json['id']).to eq(media_object.id) expect(json['title']).to eq(media_object.title) expect(json['collection']).to eq(media_object.collection.name) + expect(json['collection_id']).to eq(media_object.collection.id) expect(json['main_contributors']).to eq(media_object.creator) expect(json['publication_date']).to eq(media_object.date_created) expect(json['published_by']).to eq(media_object.avalon_publisher)