2009/9/11 Gleb Mazovetskiy <[email protected]>:
>
> def A
>   belongs_to B
>   belongs_to C
> end
>
> I want to select all the A where a.b.name LIKE "x" and a.c.name LIKE Y.
> Is it possible to do this with one SQL statement?
> --

Why do you want to use sql?  Let rails do it for you, something like
find(:all, :include => [:b, :c], :conditions => [b.name like ? and
c.name like ?, 'x', 'y'] )

Colin

--~--~---------~--~----~------------~-------~--~----~
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