我想補充Service
類別,同樣喜歡Spree::Product
,對於我定義一些協會,如下與狂歡
class Service < ActiveRecord::Base
has_many :images, -> { order(:position) }, as: :viewable, class_name: "Spree::Image", dependent: :destroy
has_many :taxons, class_name: "Spree::Taxon", dependent: :destroy
validates :name, presence: true,
length: { minimum: 5 }
end
現在關聯定製機型,首先,這是定義這樣的分類正確的方法或者我應該使用其他約定來定義Service
,並且對於:taxons
關聯,我應該如何定義遷移以在spree_taxons
表中添加service_id
列?