0

我有这样的表格:

revoke.html.arb

active_admin_form_for resource, url: revoke_active_admin_payment_subscription_path(resource) do |f|
  f.inputs do
    f.input :suspended_at, as: :datepicker, datepicker_options: { max_date: Date.today.iso8601 }
  end
  f.actions
end

但是视图因此错误而崩溃:

undefined method `suspended_at' for #<Forms::Payment::SubscriptionForm:0x00007f36462aaae8>
Did you mean?  suspended_at_from_model

如果我更改为使用suspended_at_from_model页面加载,但输入的名称、ID 和标签都不suspended_at_from_model是简单的suspended_at

为什么表单不能接受suspended_at输入?

4

1 回答 1

0

有时resource是形式,而不是模型。在这种情况下,您需要类似:

active_admin_form_for resource.model, url: revoke_active_admin_payment_subscription_path(resource) do |f|
于 2019-09-03T13:57:32.643 回答