【发布时间】:2016-05-21 15:57:10
【问题描述】:
我有三个对象:
class Picture < ActiveRecord::Base
belongs_to :imageable, :polymorphic => true
end
class Employee < ActiveRecord::Base
has_many :pictures, :as => :imageable
end
class Product < ActiveRecord::Base
has_many :pictures, :as => :imageable
end
我应该如何创建测试种子数据,以将图像与种子员工和种子产品相关联?
【问题讨论】:
标签: ruby-on-rails ruby polymorphism