Last active
January 21, 2016 22:01
-
-
Save brentmulligan/6641d4623ca7d386ba2f to your computer and use it in GitHub Desktop.
How to serialize with ActiveModelSerializer outside of a controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
serializer = PostSerializer.new(post) | |
adapter = ActiveModel::Serializer::Adapter.create(serializer) | |
# output | |
adapter.as_json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment