Setup Devise:

gem 'devise'
bundle install
rails g devise:install

In routes.rb, put this line above ‘mount RailsAdmin …. ‘:

devise_for :admin, path_names: { sign_in: 'login', sign_out: 'logout', sign_up: 'signup' }

Then:

rails g devise admin

We used ‘admin’ because we are integrating with the back-end.

In config/initializers/devise.rb:

config.secret_key = 'YOUR SECRET KEY'
config.mailer_sender = 'YOUREMAIL'

So,

rails g devise:views

In config/initializers/rails_admin.rb

RailsAdmin.config do |config|
  config.authenticate_with do
     warden.authenticate! scope: :admin
   end
   config.current_user_method(&:current_admin)
end

That’s it. Open RailsAdmin again and it should ask you to login.

Note: If you don’t have a user yet, create it in the console:

rails c
Admin.new({:email => "guy@gmail.com", :password => "123456", :password_confirmation => "123456" }).save(:validate => false)