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 <li...@ruby-forum.com> 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 rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com<rubyonrails-talk%2bunsubscr...@googlegroups.com> > . > 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 rubyonrails-t...@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.