18 Jul 13:56
ActiveRecord: SQL IN operator
From: Tim Conner <rails-mailing-list@...>
Subject: ActiveRecord: SQL IN operator
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-07-18 11:57:02 GMT
Subject: ActiveRecord: SQL IN operator
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-07-18 11:57:02 GMT
I want to use an array in the :conditions of an ActiveRecord Find so
that a SQL IN statement is created. However, I also want to specify a
greater than condition on a timestamp column too.
From the Docs:
An array may be used in the hash to use the SQL IN operator:
Student.find(:all, :conditions => { :grade => [9,11,12] })
How do I modify this so that it also contains the timestamp condition?
:condition => ['created_at > ?',time]
--
--
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 rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
RSS Feed