Please read for an updated status on RailsCasts:
Learn more or hide this
GitHub User: colderis
Late response but it can be usefull for someone else.
There's no "LIKE" command for MongoDB, you can perform a search with a regex.
But as always there's already some gem that do the work for you :
For Keyword search : https://github.com/mauriciozaffari/mongoid_search
For FullText search : https://github.com/artsy/mongoid_fulltext
def self.current(except = nil)
now = Time.current
result = where(:starts_at.lte => now, :ends_at.gte => now)
result = result.where(:id.nin => except) if except.present?
lte : less than or equal
gte : greater than or equal
nin : not in
I really love the Mongoid syntax.
Be careful with simple_form
Took me awhile to discover that you can't login if your form is built with simple_form.
My sessions controller is in an admin namespace and the builder gave me "/admin/sessions[password]".