Skip to content

Instantly share code, notes, and snippets.

@benedikt
Created March 2, 2012 17:40
Show Gist options
  • Save benedikt/1959907 to your computer and use it in GitHub Desktop.
Save benedikt/1959907 to your computer and use it in GitHub Desktop.
Makes mongoid and active_model_serializers play nicely together
# config/initializers/active_model_serializers.rb
Mongoid::Document.send(:include, ActiveModel::SerializerSupport)
Mongoid::Criteria.delegate(:active_model_serializer, :to => :to_a)
@quartzmo
Copy link

Thanks this was helpful!

@boy-jer
Copy link

boy-jer commented May 16, 2012

many thanks!

@ianpetzer
Copy link

Awesome.. thanks!

@guiltry
Copy link

guiltry commented May 20, 2014

I wasted a lot of time just for this.
Thank you.

@xuanyu-h
Copy link

Thank you!

@corehook
Copy link

corehook commented Apr 2, 2016

GJ!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment