Skip to content

Instantly share code, notes, and snippets.

@brentmulligan
Last active January 21, 2016 22:01
Show Gist options
  • Save brentmulligan/6641d4623ca7d386ba2f to your computer and use it in GitHub Desktop.
Save brentmulligan/6641d4623ca7d386ba2f to your computer and use it in GitHub Desktop.
How to serialize with ActiveModelSerializer outside of a controller
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