Thriving K.
2009-Jul-16 10:26 UTC
How to make something like IN (1,3,4) in the :conditions
named_scope :unarchive, lambda { |project_identifier|
{ :conditions => {:project_id => project_identifier,:archive => false},
order => :name}
}
Here is the code
within condition i want to make something like :id=>"IN (3,4,5)"
but i
don''t know how to write it in rails , i don''t know what to
search in
google :(
--
Posted via http://www.ruby-forum.com/.
Sijo Kg
2009-Jul-16 10:48 UTC
Re: How to make something like IN (1,3,4) in the :conditions
named_scope :unarchive, lambda { |project_identifier|
{ :conditions => [''id in (?,?,?)'',3,4,5],
}
}
Sijo
--
Posted via http://www.ruby-forum.com/.
Peter De Berdt
2009-Jul-16 11:03 UTC
Re: How to make something like IN (1,3,4) in the :conditions
On 16 Jul 2009, at 12:26, Thriving K. wrote:> named_scope :unarchive, lambda { |project_identifier| > { :conditions => {:project_id => project_identifier,:archive => > false}, > order => :name} > } > > Here is the code > > within condition i want to make something like :id=>"IN (3,4,5)" but i > don''t know how to write it in rails , i don''t know what to search in > google :(just use: :conditions => {:id => [1,2,4]} Works perfectly. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---