This commit is contained in:
Rob Smith 2016-01-13 11:13:04 +00:00
commit 8384f7a00e
3 changed files with 82 additions and 1 deletions

View file

@ -119,6 +119,73 @@ class Conference < ActiveRecord::Base
result
end
##
# Builds out the model for returning a json response
#
#
def as_json(_options={})
super(
only: [
:description,
:end_date,
:logo,
:short_title,
:start_date,
:title,
],
include: {
difficulty_levels: {
only: [
:description,
:id,
:title,
]
},
event_types: {
only: [
:description,
:id,
:length,
:title,
]
},
rooms: {
only: [
:name,
:size,
],
include: {
events: {
only: [
:abstract,
:description,
:difficulty_level_id,
:event_type_id,
:guid,
:is_highlight,
:require_registration,
:start_time,
:subtitle,
:title,
:track_id,
],
methods: [
:speaker_names,
],
},
},
},
tracks: {
only: [
:description,
:id,
:name,
]
},
}
)
end
##
# Checks if the user is registered to the conference
#