diff --git a/app/controllers/api/v1/conferences_controller.rb b/app/controllers/api/v1/conferences_controller.rb index e37c6d55..60578587 100644 --- a/app/controllers/api/v1/conferences_controller.rb +++ b/app/controllers/api/v1/conferences_controller.rb @@ -4,12 +4,15 @@ module Api load_resource find_by: :short_title respond_to :json + # Disable forgery protection for any json requests. This is required for jsonp support + skip_before_action :verify_authenticity_token + def index - render json: @conferences, serializer: ConferencesArraySerializer + render json: @conferences, serializer: ConferencesArraySerializer, callback: params['callback'] end def show - render json: [@conference], serializer: ConferencesArraySerializer + render json: [@conference], serializer: ConferencesArraySerializer, callback: params['callback'] end end end diff --git a/app/controllers/api/v1/events_controller.rb b/app/controllers/api/v1/events_controller.rb index eb77cd4f..1cb01ad9 100644 --- a/app/controllers/api/v1/events_controller.rb +++ b/app/controllers/api/v1/events_controller.rb @@ -4,6 +4,9 @@ module Api load_resource :conference, find_by: :short_title respond_to :json + # Disable forgery protection for any json requests. This is required for jsonp support + skip_before_action :verify_authenticity_token + def index events = Event.includes(:track, :event_type, event_users: :user) @@ -11,7 +14,7 @@ module Api events = events.where(program: @conference.program) end - respond_with events.confirmed + respond_with events.confirmed, callback: params[:callback] end end end diff --git a/app/controllers/api/v1/rooms_controller.rb b/app/controllers/api/v1/rooms_controller.rb index fe70fcfe..ecc959fa 100644 --- a/app/controllers/api/v1/rooms_controller.rb +++ b/app/controllers/api/v1/rooms_controller.rb @@ -4,11 +4,14 @@ module Api load_resource :conference, find_by: :short_title respond_to :json + # Disable forgery protection for any json requests. This is required for jsonp support + skip_before_action :verify_authenticity_token + def index if @conference - respond_with @conference.venue ? @conference.venue.rooms : Room.none + respond_with @conference.venue ? @conference.venue.rooms : Room.none, callback: params[:callback] else - respond_with Room.all + respond_with Room.all, callback: params[:callback] end end end diff --git a/app/controllers/api/v1/speakers_controller.rb b/app/controllers/api/v1/speakers_controller.rb index b0eb9cf6..2706d2e9 100644 --- a/app/controllers/api/v1/speakers_controller.rb +++ b/app/controllers/api/v1/speakers_controller.rb @@ -4,6 +4,9 @@ module Api load_resource :conference, find_by: :short_title respond_to :json + # Disable forgery protection for any json requests. This is required for jsonp support + skip_before_action :verify_authenticity_token + def index if @conference users = User.joins(event_users: { event: { program: :conference} }) @@ -13,7 +16,7 @@ module Api end users = users.where(event_users: {event_role: :speaker}).uniq - render json: users, each_serializer: SpeakerSerializer + render json: users, each_serializer: SpeakerSerializer, callback: params['callback'] end end end diff --git a/app/controllers/api/v1/tracks_controller.rb b/app/controllers/api/v1/tracks_controller.rb index 879713cf..48a9450f 100644 --- a/app/controllers/api/v1/tracks_controller.rb +++ b/app/controllers/api/v1/tracks_controller.rb @@ -4,10 +4,13 @@ module Api load_resource :conference, find_by: :short_title respond_to :json + # Disable forgery protection for any json requests. This is required for jsonp support + skip_before_action :verify_authenticity_token + def index tracks = @conference ? @conference.program.tracks : Track.all - respond_with tracks + respond_with tracks, callback: params[:callback] end end end