我使用带有rabl的rails,在4.0.x中它完美地在一个rabl模板中呈现正确的结果并且只是通过渲染出现错误:json => {:error => “不,没有!'}。
我用过
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"
升级到4.1后,我不得不将ActionController :: Rendering更改为AbstractController :: Rendering并包含ActionView :: Layouts。
问题:没有ActionView :: Layouts我可以渲染:json => {something}但我的模板未加载。使用ActionView :: Layouts,我得到每个渲染:json => {...}缺少模板错误。
任何提示都表示赞赏!
答案 0 :(得分:1)
工作订单和清单:
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