简体   繁体   English

Rails ActiveAdmin-覆盖模型名称时更新错误

[英]Rails ActiveAdmin - Update error when overriding a model name

I have the following code in my ActiveAdmin view: 我的ActiveAdmin视图中有以下代码:

ActiveAdmin.register IdeaAction, :as => "Action" do
  form do |f|
    f.inputs do
      f.input :description
    end
    f.actions
  end
end

When I submit my edit form, I get the following: 提交编辑表单时,我得到以下信息:

NoMethodError in Admin::ActionsController#update
undefined method `stringify_keys' for "update":String

As soon as I remove :as => "Action" override, it all works fine. 只要删除:as => "Action"覆盖,一切都可以正常工作。 Is there anything else I need to tell to ActiveAdmin for the name override? 我还有什么需要告诉ActiveAdmin覆盖名称的方法吗? Is there a workaround? 有解决方法吗?

It appears that the problem here is the keyword "Action" which is reserved by ActiveAdmin. 看来这里的问题是ActiveAdmin保留的关键字“ Action”。 The best possible solution I found was to put the override on the form ( :as => :idea_action ): 我发现的最佳解决方案是将替代放置在表单( :as => :idea_action )上:

ActiveAdmin.register IdeaAction, :as => "Action" do
  form do :as => :idea_action |f|
    f.inputs do
      f.input :description
    end
    f.actions
  end
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM