Thanks I'll try it out when I have the time

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
Ar Chron
Sent: Wednesday, December 10, 2008 4:33 AM
To: [email protected]
Subject: [Rails] Re: Active record :find having an if statement inside the 
conditions


Tyl Tan wrote:
> If x equal 200 then I want the find to check that y is equal to 300 but 
> if x is not equal to 200 there should be no check with y

Well,

:conditions => ["x <> ? or (x = ? and y = ?)", 200, 200, 300]

If SQL short-circuits the logic, that shouldn't check y when x != 200
-- 
Posted via http://www.ruby-forum.com/.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to