Reputation: 171
I use rails with rabl, in 4.0.x it worked perfectly to render the correct result in a rabl template and errors just through render :json => {:error => 'oh no!'}.
I used
ActionController::Metal and
include ActionController::ForceSSL
include ActionController::Redirecting
include ActionController::Rendering
include ActionController::RequestForgeryProtection
include ActionController::Renderers::All
include ActionController::MimeResponds
include ActionController::ImplicitRender
include AbstractController::Callbacks
include Devise::Controllers::Helpers
include ActionController::StrongParameters
protect_from_forgery with: :null_session
append_view_path "#{Rails.root}/app/views"
With the upgrade to 4.1 I had to change ActionController::Rendering to AbstractController::Rendering and include ActionView::Layouts.
The problem: Without ActionView::Layouts I can render :json => {something} but my templates are not loaded. With ActionView::Layouts I get on every render :json => {...} a Missing Template error.
Any hint is appreciated!
Upvotes: 2
Views: 526
Reputation: 171
ok, I figured it out. It was the order of my includes and instead of replacing ActionController::Rendering with AbstractController::Rendering I should have added it.
working ordering and list:
include AbstractController::Rendering
include ActionController::Redirecting
include ActionView::Layouts
include ActionController::Rendering
include ActionController::Renderers::All
include ActionController::MimeResponds
include ActionController::ImplicitRender
include ActionController::StrongParameters
include ActionController::RequestForgeryProtection
include ActionController::ForceSSL
include AbstractController::Callbacks
include Devise::Controllers::Helpers
Upvotes: 1