Active_admin未定义方法'patch'。与routes.rb发生冲突

时间:2014-03-03 07:23:25

标签: ruby-on-rails ruby routes activeadmin roles

我正在使用ruby-2.1.1,gem the_roleactive_admin

当我尝试使用

安装active_admin时
rails generate active_admin:install 

我收到以下错误:

.../config/routes.rb:25:in `block (3 levels) in <top (required)>': undefined 
method `patch' for ActionDispatch::Routing::Mapper:0x000000073516d0 (NoMethodError)

这是我的routes.rb中的代码

namespace :api, defaults: {format: 'json'} do
    scope module: :v1, constraints: ApiConstraints.new(version: 1) do
      resources :leads
    end
    scope module: :v2, constraints: ApiConstraints.new(version: 2, default: true) do
      resources :leads
      patch '/leads/update' => 'leads_controller#update', as: 'update_leads'
    end
  end

如果我替换patch =&gt; put,我在gem the_role中有另一个错误:

.../.rvm/gems/ruby-2.1.1/gems/the_role-2.3/config/routes.rb:4:in `block (3 levels) 
in <top (required)>': undefined method `patch' 
for #<ActionDispatch::Routing::Mapper:0x0000000850e990> (NoMethodError)

如何安装Active_admin? 提前谢谢!

0 个答案:

没有答案