Im using Rails 4.2.1 and Devise and
rails_admin and Im quite new to Rails.
I have a user model in the project and a login module for the users. But I need to add Rails Admin authentication. I added a new model
Admin for the purpose. I have already set up basic authentication for the Rails Admin login. But now I need to remove basic authentication and add a login page for Rails Admin. What changes do I have to do?
As for my code, I am currently using this for basic authentication:
RailsAdmin.config do |config|
authenticate_or_request_with_http_basic('Site Message') do |username, password|
authenticate_admin username, password
I have added a method
application_controller that I want to use for authentication instead.
As you are using devise with rails admin, you can use devise for the authentication.
In your rails_admin.rb add the following code:
config.authenticate_with do warden.authenticate! scope: :user end config.current_user_method(&:current_user)