Yes,

class Deck < ActiveRecord::Base
 has_many :cards
 has_many :cool_cards, :through => :cards
end

class Card < ActiveRecord::Base
end

On Tue, Apr 27, 2010 at 15:50, Ben Woodcroft <[email protected]> wrote:

> Hi,
>
> Is it possible to join multiple times to the same table with
> ActiveRecord?
>
> For instance:
> ---------------------------------
> class Deck < ActiveRecord::Base
>  has_many :cards
> end
>
> class Card < ActiveRecord::Base
> end
> -----------------------------
>
> And then I run a query for decks that contain aces and kings? Excluding
> find_by_sql queries, that is.
>
> Thanks in advance,
> ben
> --
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 

Thanks & Regards,
Dhruva Sagar.

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