Helps
find_by_name where name = 0
In Rails, User.find_by_name(“myName”) will run sql like “SELECT users.* from users where users.name = ‘myName’”
We have found that it is occasionally producing “SELECT users.* from users where users.name = 0″.
This is invalid and will give a database error. Help!
I have a vague recollection that this had to do with passing in the wrong kind of object to find_by_name. Don’t really remember details, but I’d start with putsing that (or logging it, or looking at the code to see what the possibilities for that value are).
January 31, 2013 at 3:06 pm
I’d say that in this case ’0′ is likely the result of a nil.to_s call. You just have to work backwards to sort out why.
February 2, 2013 at 9:32 pm