active_model_serializers
active_model_serializers copied to clipboard
Serializers returning reference String instead of json
Expected behavior vs actual behavior
Recently upgraded from Rails 4.2 to Rails 5. I am on active_model_serializers 0.8.4 All serializers are returning a reference string instead of calling as_json automatically.
Steps to reproduce
(e.g., detailed walkthrough, runnable script, example application)
location_data = LocationData.find(params[:id])
data = LocationDataSerializer.new(location_data)
render json: data
response is:
"#<LocationDataSerializer:0x00007fa7fcc587c0>"
This is occuring for all of my serializers since the upgrade.
Environment
ActiveModelSerializers Version (commit ref if not on tag): 0.8.4
Output of ruby -e "puts RUBY_DESCRIPTION": ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]
OS Type & Version: Mac OS X 10.13.4
Integrated application and version (e.g., Rails, Grape, etc): Rails 5.1
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)
it's working fine on Rails 5.2.0
I just tried to reproduce it, you can pull the code here
and open http://localhost:3000/users/1
output:

@austinh Any progress?
It was because of oj 3.0
Alright thanks! Did you end up removing oj or could you figure out a workaround?
@austinh bug report in oj?
@austinh @bf4 Is it possible to have AMS use oj? What changes did you make to make that happen?