Hi,

I am increasingly needing to do some more complex finds involving
several table associations.  I can usually find an SQL solution, but
find it hard to think these out using ActiveRecord find techniques.  I
guess I am thinking in SQL terms, when perhaps there is a way of
thinking in ActiveRecord terms.  Here is an example, I am guessing
this can be done without using find_by_sql

Repair has_many :notes

SELECT * FROM repairs
where exists
(select * from notes where repairs.id=notes.repair_id
           and  and notes.flagged)

Thanks
Tonypm
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to