We can scope queries in Mongoid using class methods:
Class Book
...
def self.premium
where(price: {'$gt': 20'})
end
End
Then use this:
Book.premium
It will query for books with price greater than 20.
We can scope queries in Mongoid using class methods:
Class Book
...
def self.premium
where(price: {'$gt': 20'})
end
End
Then use this:
Book.premium
It will query for books with price greater than 20.
3.145.27.58