Has anyone had success having Rails 3, Mongoid and Inherited Resources working? Any tips for making it happen? I would love to use both gems.
Currently I am running into:
undefined method `scoped'
On index actions.
Thanks!
BTW a workaround for the scoped issue is to override collection like so:
class CampaignsController < InheritedResources::Base
def collection
@campaigns ||= end_of_association_chain.paginate(:page => params[:page])
end
end
But I am looking for a more holistic approach
If you are using only mongoid, what you should do is to overwrite the default collection behavior in Inherited Resources. The default behavior is this:
https://github.com/josevalim/inherited_resources/blob/master/lib/inherited_resources/base_helpers.rb#L22-24
That said, the following should do the trick:
You can even default the collection to paginate and have pagination for free in all pages.