0
試圖找出建立我的模型的最佳方法。這就是我要怎麼回事...Rails 3:我應該如何設置has_many關係?
型號:Dog
,Video
,Photo
,User
class Dog < ActiveRecord::Base
has_many :videos
has_many :photos
belongs_to :user
end
class Video < ActiveRecord::Base
has_many :dogs
belongs_to :user
end
class Photo < ActiveRecord::Base
has_many :dogs
belongs_to :user
end
class User < ActiveRecord::Base
has_many :dogs
has_many :videos
has_many :photo
end
我應該做has_many :through
和多態?
在我以前的這個迭代,我不得不DogPhoto
和DogVideo
車型,但好像我可以有一個DogItem
模型是多態的。
想法?