Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order without direction gives an unhelpful error message #86

Open
gaffneyc opened this issue Jun 24, 2013 · 1 comment
Open

Order without direction gives an unhelpful error message #86

gaffneyc opened this issue Jun 24, 2013 · 1 comment
Milestone

Comments

@gaffneyc
Copy link

If you fail to give a direction for an order you get this really unhelpful error message:

"field_one".__sort_option__
NoMethodError:
  undefined method `to_direction' for nil:NilClass

What would be the best approach here? Converting an app from another ORM that defaults to ascending order if not specified and was thinking of doing that.

If there is a preferred direction for this I'll put together a pull request with a fix.

@sshaw
Copy link

sshaw commented Sep 26, 2014

Agreed. Really this should be mentioned in one of[1] the Mongoid docs[2]. I had to do some DuckDuckGoing to even figure out it was an option, and issue searching to figure out the solution.

[1] http://rdoc.info/gems/mongoid/3.1.6/Mongoid/Relations/Macros/ClassMethods#has_many-instance_method
[2]http://mongoid.org/en/mongoid/docs/relations.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants