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,5 +1,5 @@
json.array! @event_types do |event_type|
json.extract! event_type, :id
@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
@ -11,3 +11,4 @@ json.array! @event_types do |event_type|
end
end
end
end

View File

@ -1,5 +1,5 @@
json.array! @events do |event|
json.id event.id
@events.each do |event|
json.set! event.id do
json.title event.title
json.subtitle event.subtitle
json.length event.length
@ -10,3 +10,4 @@
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
@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,5 +1,5 @@
json.array! @tracks do |track|
json.extract! track, :id
@tracks.each do |track|
json.set! track.id do
json.name do
track.translations.each do |translation|
json.set! translation.locale, translation.name
@ -11,3 +11,4 @@ json.array! @tracks do |track|
end
end
end
end