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
誰もがよりよい解決策を持っていますか?ありがとうございました。