[raleigh.rb] Find Query - Associations Help
lawwton at gmail.com
Tue Feb 3 12:20:20 EST 2009
I am trying to create a query using rails and I am not quite sure how
to do it. I could get this done using plane old sql with no problem
and was even planning on doing that until I ran into a little issue
with find_by_sql. It seems that this does not preserve order.
What I need using Rails Active Record is the following:
I have a series of tables as follows:
tickets <habtm> users
I also have:
users <habtm> roles
What I need is a query where I can filter by roles. Essentially saying
... give me all the tickets for users whose role is 'foo'.
Thanks in advance,
More information about the raleigh-rb-members