简体   繁体   中英

Rails ActiveAdmin - Update error when overriding a model name

I have the following code in my ActiveAdmin view:

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. Is there anything else I need to tell to ActiveAdmin for the name override? Is there a workaround?

It appears that the problem here is the keyword "Action" which is reserved by ActiveAdmin. The best possible solution I found was to put the override on the form ( :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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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