Skip to content

Instantly share code, notes, and snippets.

@matthewcrist
Created December 26, 2013 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewcrist/8137684 to your computer and use it in GitHub Desktop.
Save matthewcrist/8137684 to your computer and use it in GitHub Desktop.
ActiveModel serializer with Mongoid
# config/initializers/mongoid_active_model_initializer.rb
Mongoid::Document.send(:include, ActiveModel::SerializerSupport)
Mongoid::Criteria.delegate(:active_model_serializer, to: :to_a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment