rails 3 pagination with kaminari on mongoid embedded documents -
when call paginate kaminari on collection of embedded documents following error:
(access collection document not allowed since embedded document, please access collection root document.):
any idea on how can fix ? have installed kaminari gem.
alex
you need access collection through parent object. example, given following models:
class user include mongoid::document embeds_many :bookmarks end class bookmark include mongoid::document embedded_in :user end
then paginate given user's bookmarks do:
@user.bookmarks.page(params[:page])
Comments
Post a Comment