0
我正在尝试创建一个表单,为具有一个billing_information
的模型用户创建新记录。 Billing_information
有一个属性account_name
,我想包含在表单中。我尝试使用委托方法,但它不工作。它产生: -rails_admin如何在创建表单中包含子属性
error: unknown attribute 'billing_information_account_name' for User.
class User < ActiveRecord::Base
accepts_nested_attributes_for :billing_information
has_one :billing_information, inverse_of: :user
delegate :account_name, to: :billing_information, allow_nil: true
rails_admin do
create do
field :name
field :email
field :billing_information_account_name do
def value
bindings[:object].account_name
end
end
end
end
end
有没有人有一个更好的解决方案?谢谢。