ActionController :: Metal需要什么模块才能将状态代码传递给渲染?

Mic*_*ael 5 ruby-on-rails actioncontroller

我有一个Api控制器使用ActionController :: Metal on Rails 4.1.6,如下所示:

class Api < ActionController::Metal
  include AbstractController::Rendering 
  include ActionController::ImplicitRender
  include ActionController::MimeResponds
  include ActionController::RequestForgeryProtection  
  include AbstractController::Callbacks
  include ActionController::HttpAuthentication::Token::ControllerMethods
  include ActionController::Head

  ...
end
Run Code Online (Sandbox Code Playgroud)

但是,如果我把它放在一个动作中

render 'not_found', status: 404

它正确呈现'not_found'模板但返回200状态代码.在ActionController :: Base中运行相同的渲染,它返回所需的404.我在这里缺少什么模块?

Sub*_*ial 0

替换这个:

include AbstractController::Rendering
Run Code Online (Sandbox Code Playgroud)

有了这个:

include ActionController::Rendering
Run Code Online (Sandbox Code Playgroud)