Closed NimaQu closed 1 year ago
Looks like you're using 0.10.x?
That's working as expected. AMS only serializes object. If you render a hash, AMS doesn't process that and it goes to straight to the Rails renderer as documented. If you need to render with AMS outside of the controller's responder, you'll need to invoke it directly as is documented.
Closing as invalid
Expected behavior vs actual behavior
Expected:
actual:
Steps to reproduce
(e.g., detailed walkthrough, runnable script, example application) works:
render json: user
not working:
render json: { code: 0, message: '0', data: user }
user_serializer.rb:
Environment
ActiveModelSerializers Version (commit ref if not on tag):
Output of
ruby -e "puts RUBY_DESCRIPTION"
: ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x64-mingw32]OS Type & Version: Windows 11 Integrated application and version (e.g., Rails, Grape, etc): Rails 5
Backtrace
(e.g., provide any applicable backtraces from your application)
Additonal helpful information
(e.g., Gemfile.lock, configurations, PR containing a failing test, git bisect results)