我在Ruby 2.5.1p57和Rails 5.2.1的新项目中使用了活动管理工具。一切都很好。但是,我面临着打开新资源链接或更新资源的问题。即使,如果我添加allow_params,同样的问题。
Started GET "/admin/admin_users/new" for 127.0.0.1 at 2018-10-04 20:59:08 +0530
Processing by Admin::AdminUsersController#new as HTML
AdminUser Load (0.5ms) SELECT `admin_users`.* FROM `admin_users` WHERE `admin_users`.`id` = 1 ORDER BY `admin_users`.`id` ASC LIMIT 1
↳ /home/vivek/.rvm/gems/ruby-2.5.1@regroup2/bundler/gems/activeadmin-
c301ab126b3f/lib/active_admin/base_controller.rb:39
Completed 500 Internal Server Error in 3ms (ActiveRecord: 0.5ms)
ArgumentError (wrong number of arguments (given 2, expected 0..1)):
答案 0 :(得分:0)
但是最后,通过将以下行代码添加到以下内容来解决此问题 文件:
config/initializers/active_admin.rb
def resource_params
[(params[resource_request_name] || params[resource_instance_name]).try(:permit!) || {}]
end
不确定。这是正确的方法吗?