Routing error when connecting to ActiveAdmin

I just installed ActiveAdmin and everything was going well:

The gem is installed and I ran the install command. I was able to go to localhost:3000/admin and signed in with the[email protected] and 'password' credentials as laid out in the documentation.

However, when I click on "Login", I get the following:

No route matches {:action=>"show", :controller=>"users", :id=>nil}

My routes.rb file:

devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)

devise_for :users, :path => '', :path_names => {:sign_in => 'login', :sign_out => 'logout'}

resources :offers

resources :users do
collection do
  get :currentoffers
end

My users_controller.rb:

def index
end

def show
    @user = User.find(params[:id])
end

def currentoffers
    #calls the currentoffers.js.erb file
    respond_to do |format|
        format.html
        format.js
    end
end

What I get when I run rake routes:

admin_root            /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
                           PUT        /admin/admin_users/:id(.:format)          admin/admin_users#update
                           DELETE     /admin/admin_users/:id(.:format)          admin/admin_users#destroy
           admin_dashboard            /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
    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
                           PUT        /admin/password(.:format)                 active_admin/devise/passwords#update
          new_user_session GET        /login(.:format)                          devise/sessions#new
              user_session POST       /login(.:format)                          devise/sessions#create
      destroy_user_session DELETE     /logout(.:format)                         devise/sessions#destroy
   user_omniauth_authorize            /auth/:provider(.:format)                 devise/omniauth_callbacks#passthru {:provider=>/facebook/}
    user_omniauth_callback            /auth/:action/callback(.:format)          devise/omniauth_callbacks#(?-mix:facebook)
             user_password POST       /password(.:format)                       devise/passwords#create
         new_user_password GET        /password/new(.:format)                   devise/passwords#new
        edit_user_password GET        /password/edit(.:format)                  devise/passwords#edit
                           PUT        /password(.:format)                       devise/passwords#update
  cancel_user_registration GET        /cancel(.:format)                         devise/registrations#cancel
         user_registration POST       /                                         devise/registrations#create
     new_user_registration GET        /sign_up(.:format)                        devise/registrations#new
    edit_user_registration GET        /edit(.:format)                           devise/registrations#edit
                           PUT        /                                         devise/registrations#update
                           DELETE     /                                         devise/registrations#destroy

Would anyone know why I am getting this error? Is is that including the users resource in the routes.rb file is interfering with ActiveAdmin?

---Update:

# Application_controller.rb:

class ApplicationController < ActionController::Base
    protect_from_forgery

def after_sign_in_path_for(resource)
    user_path(@user)
end

end

try this,

def after_sign_in_path_for(resource)
  user_path(resource)
end

problem is in,

user_path(@user)

where @user is not defined, hence nil.

關鍵詞:Devise

相關推薦:

A Rock Solid, Modern Web Stack—Rails 5 API + ActiveAdmin + Create React App on Heroku

Official Django REST Framework Tutorial - A Beginners Guide

Let’s Build: With Ruby on Rails – Book Library App with Stripe Subscription Payments

Changing the Editing Path After Editing the User Page

Rails Redirect to an anchor tag on the controller

Add Account

Exploring Google Analytics data with MapD

Let’s Build: With Ruby on Rails – eCommerce Music Shop

AlloyCI Dev Diary — Part 4

Can not find Project with 'id' &equals;