I ran:
rails g active_admin:install
并得到这个错误:
Invalid route name, already in use: 'admin_root' (ArgumentError)
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:
我什至无法运行耙子路线。当我这样做时,我遇到了同样的错误。
这是我的路线文件:
Stynyl::Application.routes.draw do
resources :things
devise_for :users
resources :users, only: [:show, :new, :create]
get '/about', to: 'pages#about'
root 'things#index'
end
EDITS
I did a:
rails destroy active_admin:install
并再次运行安装命令。遇到同样的错误。路线名称无效,已被使用。
从架构中清除 ActiveAdmin。仍然出现错误。
还注意到卸载并不是 100% 干净。留下了一些样式和 JavaScript 文件,但这些似乎根本不会影响应用程序。
我像这样更新了我的 Gemfile:
gem 'activeadmin', github: 'gregbell/active_admin'
gem 'ransack', github: 'ernie/ransack'
gem 'inherited_resources', github: 'josevalim/inherited_resources'
gem 'formtastic', github: 'justinfrench/formtastic'
group :development do
gem 'sqlite3'
end
尝试运行 ActiveAdmin 安装生成器并得到相同的错误。我无法迁移数据库。这是我得到的错误:
SQLite3::SQLException: table "admin_users" already exists: CREATE TABLE "admin_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL, "encrypted_password" varchar(255) DEFAULT '' NOT NULL, "reset_password_token" varchar(255), "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0 NOT NULL, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar(255), "last_sign_in_ip" varchar(255), "created_at" datetime, "updated_at" datetime) /Users/DylanRichards/.rvm/gems/ruby-2.0.0-p247/gems/sqlite3-1.3.8/lib/sqlite3/database.rb:91:in `initialize'
检查我的架构文件,我什至没有看到表“admin_users”。
然而,我现在能做的是运行rake routes
。这是输出:
Prefix Verb URI Pattern Controller#Action
new_admin_user_session GET /admin/login(.:format) active_admin/devise/sessions#new
admin_user_session POST /admin/login(.:format) active_admin/devise/sessions#create
destroy_admin_user_session DELETE|GET /admin/logout(.:format) active_admin/devise/sessions#destroy
admin_user_password POST /admin/password(.:format) active_admin/devise/passwords#create
new_admin_user_password GET /admin/password/new(.:format) active_admin/devise/passwords#new
edit_admin_user_password GET /admin/password/edit(.:format) active_admin/devise/passwords#edit
PATCH /admin/password(.:format) active_admin/devise/passwords#update
PUT /admin/password(.:format) active_admin/devise/passwords#update
things GET /things(.:format) things#index
POST /things(.:format) things#create
new_thing GET /things/new(.:format) things#new
edit_thing GET /things/:id/edit(.:format) things#edit
thing GET /things/:id(.:format) things#show
PATCH /things/:id(.:format) things#update
PUT /things/:id(.:format) things#update
DELETE /things/:id(.:format) things#destroy
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
admin_root GET /admin(.:format) admin/dashboard#index
batch_action_admin_admin_users POST /admin/admin_users/batch_action(.:format) admin/admin_users#batch_action
admin_admin_users GET /admin/admin_users(.:format) admin/admin_users#index
POST /admin/admin_users(.:format) admin/admin_users#create
new_admin_admin_user GET /admin/admin_users/new(.:format) admin/admin_users#new
edit_admin_admin_user GET /admin/admin_users/:id/edit(.:format) admin/admin_users#edit
admin_admin_user GET /admin/admin_users/:id(.:format) admin/admin_users#show
PATCH /admin/admin_users/:id(.:format) admin/admin_users#update
PUT /admin/admin_users/:id(.:format) admin/admin_users#update
DELETE /admin/admin_users/:id(.:format) admin/admin_users#destroy
admin_dashboard GET /admin/dashboard(.:format) admin/dashboard#index
batch_action_admin_comments POST /admin/comments/batch_action(.:format) admin/comments#batch_action
admin_comments GET /admin/comments(.:format) admin/comments#index
POST /admin/comments(.:format) admin/comments#create
admin_comment GET /admin/comments/:id(.:format) admin/comments#show
users POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
user GET /users/:id(.:format) users#show
about GET /about(.:format) pages#about
root GET / things#index