active_decorator icon indicating copy to clipboard operation
active_decorator copied to clipboard

Support decorating Mongoid::Criteria

Open johanlindblad opened this issue 12 years ago • 2 comments

I have added support for decorating Mongoid::Criteria objects. I usually do @thing = Thing.all and the Mongoid::Criteria object that returns fails to get decorated when its passed to the view.

johanlindblad avatar Mar 24 '13 19:03 johanlindblad

I was looking for some sort of a single method I could override to decorate whenever the Criteria returns model instances, which would have been a much prettier solution. Unfortunately I could find one, so I overrode the methods I normally use in my views. Maybe someone can find a better way.

johanlindblad avatar Mar 24 '13 19:03 johanlindblad

+1 This is exactly what I was doing. Tested with Rails 4, Ruby 2 and Mongoid 4 (master branch). Thanks!

icortex avatar Nov 27 '13 21:11 icortex