From: Ryan Davis Date: 2012-04-26T09:38:15+09:00 Subject: Re: Method Missing as Filter On Apr 25, 2012, at 16:13 , Christopher D. wrote: > Let's say I have a model called User. User has two attributes or table > columns: id, username > > I can check that there is indeed a username ("Tom") and return 1 if > there is one and 0 by using this code > User.find_by_username("Tom")? 1 : 0 > > How would I find out Tom's corresponding id? 1) This is a rails question, not a ruby question. Please use the appropriate forum. 2) You do know that both 0 and 1 are truthy in ruby, yes? Don't get bit by that.