Change the api format to a set

This commit is contained in:
Petko Bordjukov 2015-10-17 17:28:57 +03:00
parent fa50438acd
commit a9803853c0
6 changed files with 47 additions and 34 deletions

View File

@ -1,13 +1,14 @@
json.array! @event_types do |event_type|
json.extract! event_type, :id
json.name do
event_type.translations.each do |translation|
json.set! translation.locale, translation.name
@event_types.each do |event_type|
json.set! event_type.id do
json.name do
event_type.translations.each do |translation|
json.set! translation.locale, translation.name
end
end
end
json.description do
event_type.translations.each do |translation|
json.set! translation.locale, translation.description
json.description do
event_type.translations.each do |translation|
json.set! translation.locale, translation.description
end
end
end
end

View File

@ -1,12 +1,13 @@
json.array! @events do |event|
json.id event.id
json.title event.title
json.subtitle event.subtitle
json.length event.length
json.language event.language
json.abstract event.abstract
json.description event.description
json.event_type_id event.event_type_id
json.track_id event.track_id
json.participant_user_ids event.participations.map(&:participant_id)
@events.each do |event|
json.set! event.id do
json.title event.title
json.subtitle event.subtitle
json.length event.length
json.language event.language
json.abstract event.abstract
json.description event.description
json.event_type_id event.event_type_id
json.track_id event.track_id
json.participant_user_ids event.participations.map(&:participant_id)
end
end

View File

@ -1 +1,5 @@
json.array! @halls, :id, :name
@halls.each do |hall|
json.set! hall.id do
json.extract! hall, :name
end
end

View File

@ -1 +1,5 @@
json.array! @slots, :hall_id, :event_id, :starts_at, :ends_at
@slots.each do |slot|
json.set! slot.id do
json.extract! slot, :hall_id, :event_id, :starts_at, :ends_at
end
end

View File

@ -1,4 +1,6 @@
json.array! @speakers do |speaker|
json.extract! speaker, :user_id, :twitter, :github, :biography, :public_email, :organisation, :last_name, :first_name
json.picture speaker.picture.serializable_hash
@speakers.each do |speaker|
json.set! speaker.id do
json.extract! speaker, :twitter, :github, :biography, :public_email, :organisation, :last_name, :first_name
json.picture speaker.picture.serializable_hash
end
end

View File

@ -1,13 +1,14 @@
json.array! @tracks do |track|
json.extract! track, :id
json.name do
track.translations.each do |translation|
json.set! translation.locale, translation.name
@tracks.each do |track|
json.set! track.id do
json.name do
track.translations.each do |translation|
json.set! translation.locale, translation.name
end
end
end
json.description do
track.translations.each do |translation|
json.set! translation.locale, translation.description
json.description do
track.translations.each do |translation|
json.set! translation.locale, translation.description
end
end
end
end