Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unintended dependency to active_record #1656

Closed
andreaseger opened this issue Apr 4, 2016 · 0 comments
Closed

Unintended dependency to active_record #1656

andreaseger opened this issue Apr 4, 2016 · 0 comments

Comments

@andreaseger
Copy link
Contributor

Expected behavior vs actual behavior

I expect to be able to use AMS without active_record. What I'm seeing is that to_json won't serialize the serializer adapter instance correctly if I don't explicitly call as_json before hand. If I load active_record and establish a database connection a simple call to to_json will work as expected

Steps to reproduce

Please have a look at this gist
https://gist.github.com/andreaseger/84edad45b690b142c401a170b742aafb

Environment

ActiveModelSerializers Version (commit ref if not on tag): latest master (d30aa4c)

Output of ruby -e "puts RUBY_DESCRIPTION": ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]

Additonal helpful information

Although I originally found this dependency issue with active_record in one of our apps @groyoh noticed that requiring active_support/json is enough to fix the behavior of to_json

@bf4 bf4 closed this as completed in af2b38c Apr 4, 2016
andreaseger added a commit to runtastic/active_model_serializers that referenced this issue Apr 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant