I've read about many to many relationship in rails 3 and saw that HABTM has been "deprecated", as in one should use has_many :through
most of the time.
I saw plenty of examples where the Join Model has a clear name, for example Magazine, Suscriber = Subscriptions.
But in my case I can't find a good name :/ Is there any convention I should be aware of? Top contains 1 or * Ideas, and an Idea can be in 1 or * Tops. Finally is this the best way to this at all?
Here is my code :
class Top < ActiveRecord::Base
has_many :???
has_many :ideas, :through => :???
end
class Idea < ActiveRecord::Base
has_many :???
has_many :ideas, :through => :???
end
class ??? < ActiveRecord::Base
belongs_to :top
belongs_to :idea
end
Also by using a has_many through I don't need to create manually a join table right ?
Thanks for any help :)
Edit :
A top is like a ranking. So a top is a representation of ideas sorted by their votes. An Idea is an idea (in general). Can be for instance a top of best practices for ruby on rails and an idea "use has_many through instead of HABTM".
So a Top contains 1 or * Ideas and an Idea can belong to 1 or * tops. For ideas it's more a belongs_to_many but it doesn't exist in ror.