Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Tools
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

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

Helge Holzmann
Thursday, January 31, 2013

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!

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

2 Comments

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

    January 31, 2013 at 3:06 pm

  2. Austin Putman says:

    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

Add New Comment Cancel reply

Your email address will not be published.

Helge Holzmann

Helge Holzmann
San Francisco

Recent Posts

  • 02/01/2013 – Don’t Byte Me (SF STANDUP)
  • 1/29/2013 – Rails hacked again (SF Standup)
  • 1/28/2013 – Upgrade your Devises (SF Standup)
Subscribe to Helge's Feed

Author Topics

agile (4)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Tools
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >