我在此网址跟踪了active_admin的教程:activeadmin
我尝试将它添加到已经存在的项目中,遵循以下不同的步骤:
gem 'activeadmin', github: 'activeadmin'
rails g active_admin:install --skip-users
rake db:migrate && rails server
我的问题是,当我想访问localhost:3000 / admin时,我收到此错误Unknown Action AbstractController::ActionNotFound
这是我的routes.rb
Rails.application.routes.draw do
config = ActiveAdmin::Devise.config
config[:controllers][:sessions] = 'sessions'
config[:controllers][:registrations] = 'registrations'
config[:as] = 'admin'
devise_for :users, config
# Login / Logout routes
namespace :v1, path: '/' do
devise_scope :user do
post '/sessions', to: 'sessions#create'
post '/registrations', to: 'registrations#create'
delete '/sessions', to: 'sessions#destroy'
end
# User routes
get '/user', to: 'users#show'
patch '/user/update', to: 'users#update'
end
ActiveAdmin.routes(self)
end
我使用rails 4.2.1和ruby 2.2.2
更新09/06
rake routes
new_admin_user_session GET /admin/login(.:format) sessions#new
admin_user_session POST /admin/login(.:format) sessions#create
destroy_admin_user_session DELETE|GET /admin/logout(.:format) 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
cancel_admin_user_registration GET /admin/cancel(.:format) registrations#cancel
admin_user_registration POST /admin(.:format) registrations#create
new_admin_user_registration GET /admin/sign_up(.:format) registrations#new
edit_admin_user_registration GET /admin/edit(.:format) registrations#edit
PATCH /admin(.:format) registrations#update
PUT /admin(.:format) registrations#update
DELETE /admin(.:format) registrations#destroy
v1_sessions POST /sessions(.:format) v1/sessions#create
v1_registrations POST /registrations(.:format) v1/registrations#create
DELETE /sessions(.:format) v1/sessions#destroy
v1_user GET /user(.:format) v1/users#show
v1_user_update PATCH /user/update(.:format) v1/users#update
admin_root GET /admin(.:format) admin/dashboard#index
admin_dashboard GET /admin/dashboard(.: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_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
和日志
F, [2015-06-09T10:45:02.609120 #2451] FATAL -- :
AbstractController::ActionNotFound (AbstractController::ActionNotFound):
/home/snoobie/.rvm/gems/ruby-2.2.2/bundler/gems/activeadmin-0b4b22871fd3/lib/active_admin/base_controller.rb:29:in `only_render_implemented_actions'
我希望有人可以解释我做错了什么。 谢谢!
答案 0 :(得分:0)
我使用rails_admin解决了这个问题,更容易聚集到项目中。如果有人需要更多关于在rails项目中添加rails_admin的过程的信息。请发表评论,我会详细解释。