Reputation: 464
I'd like to use the Mongoid criteria methods ( http://mongoid.org/docs/querying/criteria.html ). I have a model named College. In the College controller:
def index
@colleges = College.all_of(:sat_rmw.gt => 1200, :in_state_tuition.lt => 12000)
end
This generates the error:
undefined method `all_of' for College:Class
Am I supposed to use criteria in the College Model as opposed to the Controller? Thanks in advance!
Upvotes: 0
Views: 1136
Reputation: 9659
I was having this same problem too (might be a bug in the current version, but I can't find any tickets regarding it). Whatever the case, you can replicate this behaviour using the where
and and
methods instead. Your query above would become:
@colleges = College.where(:sat_rmw.gt => 1200).and(:in_state_tuition.lt => 12000)
Upvotes: 1