【发布时间】:2015-05-15 00:39:41
【问题描述】:
我有 ActiveAdmin 和 Devise 与用户合作。我想使用 Devise 登录具有相同用户模型的常规非管理员用户。我怎样才能做到这一点? (我想在 User 模型中有一个 admin 标志,仅供管理员使用。)我尝试将第二行添加到 routes.rb
devise_for :users, ActiveAdmin::Devise.config
devise_for :users
但是当我尝试列出路线时它给出了错误
>rake routes
DL is deprecated, please use Fiddle
rake aborted!
ArgumentError: Invalid route name, already in use: 'new_user_session'
You may have defined two routes with the same name using the `:as` option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created with `resources` as explained here:
http://guides.rubyonrails.org/routing.html#restricting-the-routes-created
我创建了一个仅检查user.admin == true 的授权适配器,它对ActiveAdmin 来说工作正常。 https://github.com/activeadmin/activeadmin/blob/master/docs/13-authorization-adapter.md
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-4 devise activeadmin