Issue when ordering in pagination #479

Closed
ilanstern opened this Issue Dec 5, 2012 · 1 comment

Projects

None yet

2 participants

@ilanstern

Tried to do the following query:
@events = Event.fields(:id, :name, :state, :start_date).paginate({:order => :created_at.desc, page: page, per_page: Event.per_page})

And received this error:
NoMethodError (undefined method `flatten' for #Squeel::Nodes::Order:0x007fdf9faa04e8).

Could only solve it doing:
@events = Event.fields(:id, :name, :state, :start_date).paginate({:order => 'created_at DESC', page: page, per_page: Event.per_page})

@cheald
Member
cheald commented Jul 6, 2013

This looks like a conflict between MongoMapper's symbol extensions and Squeel's. See their extensions. In the case where two libraries are both trying to add the same behavior, it's going to have to be up to the user to resolve the conflicts, unfortunately.

@cheald cheald closed this Jul 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment