I have an Api controller using ActionController::Metal on Rails 4.1.6 like this:
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
However, if I put this in an action
render 'not_found', status: 404
It renders the 'not_found' template correctly but returns a 200 status code. Running the same render in ActionController::Base, it returns the desired 404. What module am I missing here?
try to include these 3 modules in the same order
include AbstractController::Rendering
include ActionView::Rendering
include ActionController::Rendering
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With