当用户通过设计注册时,我正在尝试创建一个新的合作伙伴对象,然后在创建用户时分配该关系。这是我目前拥有的:
模型/用户.rb
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :token_authenticatable, :omniauthable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :admin, :partner_ids, :provider, :uid
#has_and_belongs_to_many :partners
has_many :partners, :through => :partners_users
has_many :partners_users
accepts_nested_attributes_for :partners_users
accepts_nested_attributes_for :partners
def with_partner
self.partners.build
self
end
模式/合作伙伴.rb
attr_accessible :name, :address, :verified, :verification_code
has_many :users, :through => :partners_users
has_many :partners_users
has_many :places
has_many :offers
报名表
registration_path(resource_name) 做 |f| %> 账户信息 商业信息 5 %> “大花式按钮” %>目前,当我提交表单时,出现以下错误:
Can't mass-assign protected attributes: partner
我在这里做错了什么?