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| @event_types.each do |event_type|
json.extract! event_type, :id json.set! event_type.id do
json.name do json.name do
event_type.translations.each do |translation| event_type.translations.each do |translation|
json.set! translation.locale, translation.name json.set! translation.locale, translation.name
end
end end
end json.description do
json.description do event_type.translations.each do |translation|
event_type.translations.each do |translation| json.set! translation.locale, translation.description
json.set! translation.locale, translation.description end
end end
end end
end end

View File

@ -1,12 +1,13 @@
json.array! @events do |event| @events.each do |event|
json.id event.id json.set! event.id do
json.title event.title json.title event.title
json.subtitle event.subtitle json.subtitle event.subtitle
json.length event.length json.length event.length
json.language event.language json.language event.language
json.abstract event.abstract json.abstract event.abstract
json.description event.description json.description event.description
json.event_type_id event.event_type_id json.event_type_id event.event_type_id
json.track_id event.track_id json.track_id event.track_id
json.participant_user_ids event.participations.map(&:participant_id) json.participant_user_ids event.participations.map(&:participant_id)
end
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| @speakers.each do |speaker|
json.extract! speaker, :user_id, :twitter, :github, :biography, :public_email, :organisation, :last_name, :first_name json.set! speaker.id do
json.picture speaker.picture.serializable_hash json.extract! speaker, :twitter, :github, :biography, :public_email, :organisation, :last_name, :first_name
json.picture speaker.picture.serializable_hash
end
end end

View File

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