Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

1/31/2013 – find_by_name where name is strange (SF STANDUP)


find_by_name where name = 0

In Rails, User.find_by_name(“myName”) will run sql like “SELECT users.* from users where = ‘myName'”

We have found that it is occasionally producing “SELECT users.* from users where = 0″.

This is invalid and will give a database error. Help!

  1. Jim Kingdon says:

    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).

  2. 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.

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *