0
圖庫我有3種型號organization
campaign
和vacancy
這都需要一個圖片庫Rails應用程序。 我想使另一個模型Gallery
是has_many
images
然後用carrierwave多個圖像上傳到畫廊。我如何將畫廊模型與3種不同的模型相關聯?多態關聯?不同型號和carrierwave
圖庫我有3種型號organization
campaign
和vacancy
這都需要一個圖片庫Rails應用程序。 我想使另一個模型Gallery
是has_many
images
然後用carrierwave多個圖像上傳到畫廊。我如何將畫廊模型與3種不同的模型相關聯?多態關聯?不同型號和carrierwave
你可以採取的畫廊模式與圖像領域,上傳圖像與載波和協會將這些類型的
組織
has_many :galleries ,:as => :imageable
活動 的has_many
:galleries,:as => :imageable
空缺
has_many :galleries,:as => :imageable
畫廊
belongs_to :imageable , polymorphic: true
imageable_id
和imageable_type
也將在畫廊模式