Skip to content

Instantly share code, notes, and snippets.

@heptat
Created April 11, 2014 01:42
Show Gist options
  • Save heptat/10436561 to your computer and use it in GitHub Desktop.
Save heptat/10436561 to your computer and use it in GitHub Desktop.
rails 4.1 JSON API problem
class ApplicationController < ActionController::Metal
include ActionController::Helpers
include ActionController::Redirecting
# Rendering MUST be before Renderers::All
include AbstractController::Rendering
include ActionController::Renderers::All
# this is now in ActionView::Layouts:
# include AbstractController::Layouts
include ActionView::Layouts
include ActionController::ConditionalGet
include ActionController::MimeResponds
include ActionController::RequestForgeryProtection # not sure I need this
include ActionController::ForceSSL
include AbstractController::Callbacks
include ActionController::Instrumentation
include ActionController::ParamsWrapper
include ActionController::StrongParameters
include ActionController::Serialization # for active_model_serializers
include Rails.application.routes.url_helpers
# some stuff
end
class VouchersController
respond_to :json
def update
# do some stuff
render json: response.to_json, status: 422
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment