active_decorator
active_decorator copied to clipboard
Support decorating Mongoid::Criteria
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.
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.
+1 This is exactly what I was doing. Tested with Rails 4, Ruby 2 and Mongoid 4 (master branch). Thanks!