Gareth Adams wrote:> I''ve programmatically built an array suitable for
> ActiveRecord::Base.find()s
> :conditions parameter. However, I''m also doing a find_by_sql on
the same
> model
> and I want to generate the relevant WHERE clause.
>
> Does Activerecord have an easy way to do this? I can''t see
anything
> immediately
> in the docs
>
> Thanks,
> Gareth
Look at sanitize_sql. It can accept an array with the first item being
an sql statement and subsequent items being the replacement values for
placeholders. Pass your conditions array to it, and a string will be
returned.
--
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-/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
-~----------~----~----~----~------~----~------~--~---