Dhruva Sagar wrote:
> Yes,
> 
> class Deck < ActiveRecord::Base
>  has_many :cards
>  has_many :cool_cards, :through => :cards
> end

Thanks for the help Dhruva, but doesn't that mean that there is a 
cool_cards foreign key in the cards cards table? I don't quite 
understand how this helps - what query would you run to get decks that 
have aces and kings?

I should also add some details to the schema, in case I wasn't clear.
------------------------------------
class Deck < ActiveRecord::Base
  has_many :cards
end

class Card < ActiveRecord::Base
  belongs_to :deck
  # has a "name" attribute/column, which is king/ace/jack/etc.
end
------------------------------------

Thanks,
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.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to