Hey guys, I'm new to rails here are the 2 ways of making a Drummer model and Cymbal model both have many videos
1st way by using polymorphic:
class Drummer < ActiveRecord::Base
has_many :videos, :as => :videoable
end
class Cymbal < ActiveRecord::Base
has_many :videos, :as => :videoable
end
class Video < ActiveRecord::Base
belongs_to :videoable, :polymorphic => true
end
2nd way by using two 1:m association:
class Drummer < ActiveRecord::Base has_many :videos end
class Cymbal < ActiveRecord::Base has_many :videos, end
class Video < ActiveRecord::Base belongs_to :drummer belongs_to :cymbal end
I haven't try them in console, But I think both will work as they should. But I don't know the difference?