Active Admin is a gem used for having an admin dashboard in your application. It uses Devise for logging in users and creates a separate admin_user
model for th
I was able to solve this. The issue was related to Devise expecting a single user model in the application. Here is how to fix it.
In the config/initializers/devise.rb
file, add:
config.scoped_views = true
and
config.default_scope = :user #or whichever is your regular default user model
thats it, warden checks the :user for being logged in and not :admin_user
What worked for me is:
constraint = lambda { |request| request.env["warden"].authenticate? and request.env['warden'].user.instance_of?(AdminUser) }
I am not sure, but you can try something like
root :to => proc { |env| [ 302, {'Location'=> env["warden"].authenticate? ? "users/dashboard" : "/home" }, [] ] }
Why are you using the get "/"
? You should remove it. I'm using a definition pretty similar to yours and works fine with me. Use just:
root :to => 'users#dashboard', :constraints => lambda {|r| r.env["warden"].authenticate? }
root :to => 'home#index'