Common routing in Active Admin - Rails 3.1

I am currently trying to use the Active Admin Gem with a Rails 3.1 app already installed. This application uses the after_sign_in_path_for method declared in the application controller.

I followed the steps out there https://github.com/gregbell/active_admin , the thing is, when I try to access 0.0.0.0:3000/admin or localist: 3000 / admin I am directly redirected to my home path.

Here's my route.rb file,

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 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

      

Any idea? I have no idea what's in "ActiveAdmin.routes (self)", so that's why I am posting ...

Thank: -)

And here are my rake routes

    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"}

      

+3


source to share


2 answers


Copying an answer from comments to remove this question from the No Answer filter:

Actually the problem was that I set the path after sign_in for development and I had to change it if we enter admin panel. To do this, I just added a test and used the "super" keyword to keep the super after_sign_in_path method clean when registering with admin_panel. It was suggested in this comment: https://github.com/gregbell/active_admin/issues/1133#issuecomment-4967768



~ answer to David Fabreguette

+1


source


Because you have configured the device. Thus, you must "exclude" the active admin path from development.

Your path is localhost:3000/admin

checked against the fact that you are logged in, unless it redirects you to your home page.



Add this line to your app->config->initializers->active_admin.rb

file:

config.skip_before_filter :authenticate_user!

      

+2


source







All Articles