Tag: 多态 关联

用belongs_to多态来接受belongs_nested_attributes_for

我想build立一个与accepts_nested_attributes_for的多态关系。 这里是代码: class Contact <ActiveRecord::Base has_many :jobs, :as=>:client end class Job <ActiveRecord::Base belongs_to :client, :polymorphic=>:true accepts_nested_attributes_for :client end 当我尝试访问Job.create(…, :client_attributes=>{…}给我NameError: uninitialized constant Job::Client