現在、devise で既に構成されている既存の Rails 3.1 アプリで Active Admin Gem を使用しようとしています。このアプリは、アプリケーション コントローラーで宣言された after_sign_in_path_for メソッドを使用します。
https://github.com/gregbell/active_adminで説明されている手順に従いました。問題は、 0.0.0.0:3000/admin または localist:3000/admin にアクセスしようとすると、ホームパスに直接リダイレクトされることです。
これが私のroute.rbファイルです。
Fish::Application.routes.draw do
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
get "goodnewslikes/create"
get "goodnewslikes/destroy"
resources :goodnews
match "goodnews/share/:id" => "Goodnews#share", :as => "share_goodnews"
match "churches/:id/changepicture" => "Churches#changepicture", :as => "change_picture_church"
resources :churches
match "home" => "Application#home", :as => "home"
match "currenthome" => "Application#currenthome", :as => "currenthome"
match "globalsearch" => "Application#globalsearch", :as => "globalsearch"
match "create_commentlike/:comment_id" => "Commentlikes#create", :as => "create_commentlike"
resources :commentlikes, :only => [:destroy]
match "create_postlike/:post_id" => "Postlikes#create", :as => "create_postlike"
resources :postlikes, :only => [:destroy]
match "create_goodnewslike/:goodnews_id" => "Goodnewslikes#create", :as => "create_goodnewslike"
resources :goodnewslikes, :only => [:destroy]
match "create_notifiations/:type/:user_id/:content_id" => "Notifications#create", :as => "create_notification"
match "notifications/updateList" => "Notifications#updateList"
resources :notifications, :except => [:edit, :create]
resources :comments, :except => [:new]
match "posts/:id/loadpic" => "Posts#loadpic", :as => "load_post_pic"
match "comments/new/:post_id" => "Comments#new", :as => "new_comment"
resources :friendships
get "friendships/:id/accept" => "Friendships#accept", :as => "accept_friendship"
get "friendships/:id/block" => "Friendships#block", :as => "block_friendship"
get "users/searching" => "Users#searching", :as => "searching_users"
resources :users, :only => [:index, :show] do
match "profils/nouveau" => "Profils#new", :as => "new_profil"
match "profils/:id/modifier" => "Profils#edit", :as => "edit_profil"
resources :profils
end
match "users/search" => "Users#search", :as => "search_users"
match "posts_of/:user_id" => "Posts#index", :as => "posts_of"
resources :posts
devise_for :users, :path_prefix => "d"
root :to => "Application#home"
match "*path" => 'application#handle_404'
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => 'welcome#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
end
何か案が ?「ActiveAdmin.routes(self)」に何が入っているのかわからないので、投稿しています...
ありがとう :-)
そして、これが私のレーキルートです
new_admin_user_session GET /admin/login(.:format) {:action=>"new", :controller=>"active_admin/devise/sessions"}
admin_user_session POST /admin/login(.:format) {:action=>"create", :controller=>"active_admin/devise/sessions"}
destroy_admin_user_session DELETE|GET /admin/logout(.:format) {:action=>"destroy", :controller=>"active_admin/devise/sessions"}
admin_user_password POST /admin/password(.:format) {:action=>"create", :controller=>"active_admin/devise/passwords"}
new_admin_user_password GET /admin/password/new(.:format) {:action=>"new", :controller=>"active_admin/devise/passwords"}
edit_admin_user_password GET /admin/password/edit(.:format) {:action=>"edit", :controller=>"active_admin/devise/passwords"}
PUT /admin/password(.:format) {:action=>"update", :controller=>"active_admin/devise/passwords"}
admin_dashboard /admin(.:format) {:action=>"index", :controller=>"admin/dashboard"}
admin_admin_users GET /admin/admin_users(.:format) {:action=>"index", :controller=>"admin/admin_users"}
POST /admin/admin_users(.:format) {:action=>"create", :controller=>"admin/admin_users"}
new_admin_admin_user GET /admin/admin_users/new(.:format) {:action=>"new", :controller=>"admin/admin_users"}
edit_admin_admin_user GET /admin/admin_users/:id/edit(.:format) {:action=>"edit", :controller=>"admin/admin_users"}
admin_admin_user GET /admin/admin_users/:id(.:format) {:action=>"show", :controller=>"admin/admin_users"}
PUT /admin/admin_users/:id(.:format) {:action=>"update", :controller=>"admin/admin_users"}
DELETE /admin/admin_users/:id(.:format) {:action=>"destroy", :controller=>"admin/admin_users"}