Description
Expected behavior vs actual behavior
In my controller I still want to render an arbitrary Hash as json with an option to set response status. So, while in one action I'd like to use AMS implicitly with render json: @object
, I'd still like to use something like render json: { message: message }, status: status
without hitting the AMS.
Steps to reproduce
(e.g., detailed walkthrough, runnable script, example application)
def some_action
...
message = 'Incorrect URL'
status = :bad_request
render json: { message: message }, status: status
end
Environment
ActiveModelSerializers Version (commit ref if not on tag): 0.10.4
Output of ruby -e "puts RUBY_DESCRIPTION"
: ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin15]
OS Type & Version: Mac OS X 10.11.6
Integrated application and version (e.g., Rails, Grape, etc): Rails 5.0.1
Default adapter.
Backtrace
(e.g., provide any applicable backtraces from your application)
[active_model_serializers] Rendered ActiveModel::Serializer::Null with Hash (0.14ms)
I'd need to run some benchmark to determine if it actually slows down the response significantly or not.