watch this  

the official mrchucho blog

Impressed Again

Posted 2006 Dec 12

I’ve been working on a big Rails project and I’m still finding things that impress me. Recently, I wanted the equivalent of SQL’s “IN” statement, e.g.


select *
from people
where first_name in ('MrChucho','MsChucho')
I wasn’t immediately sure how to do this with Active Record, so I tried what seemed most intuitive: passing an Array to find…

Person.find_by_first_name(['MrChucho','MsChucho'])
It worked perfectly!

Responses to "Impressed Again"

cat claws

2008 Aug 08 at 19:30

don’t quite get it…but lets see… mr. know it all…

Comments are now closed.
atom rss