My query is dead simple, not sure what is going on:
User.rb
def self.find_house_number(house_number)
User.where("house_number = ?", house_number)
end
So calling it:
User.find_house_number("9998883333")
I get the error:
wrong number of arguments (2 f开发者_如何学JAVAor 1)
Any ideas?
#where
takes a conditions hash, not a SQL-like string. You should do this instead:
User.where(:house_number => house_number)
Note that MongoDB has nothing to do with SQL, so you shouldn't assume that SQL fragments will work.
精彩评论