-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirect loop when visiting /admin #715
Comments
You just need to set current_user_method so that RA knows which user to use, that's all. Check your initializer. Can you give me your Gemfile, so I can see why Thor screwed up with the gem 'devise'? |
Hi, thanks for the fast reply! This is setup in my initializer:
Do I need to implement the Brewster::Application.routes.draw do
mount RailsAdmin::Engine => '/admin', :as => 'rails_admin'
devise_for :admin_users
root :to => 'pages#home'
end Regarding the gemfile, here it is with the devise reference moved down onto a newline: source 'http://rubygems.org'
gem 'rails', '3.1.0'
gem 'simple_form'
gem 'haml-rails'
gem 'jquery-rails'
gem 'cancan'
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
group :test do
gem 'turn', :require => false
gem 'cucumber-rails'
gem 'database_cleaner'
gem 'shoulda'
gem 'launchy'
gem 'simplecov', '>= 0.4.0', :require => false
end
group :test, :development do
gem "rspec-rails"
gem 'sqlite3'
gem 'fabrication'
end
group :development do
gem 'pry' # To use pry with the rails console use: $ pry -r ./config/environment
# To debug, add the following in source code:
# => binding.pry
# then go to the webserver terminal (see http://railscasts.com/episodes/280-pry-with-rails)
end
gem "devise" Any thing I can try to debug the problem? Sorry for being a n00b. |
I'm also having this issue with a fresh install. My model is called 'admin', but other than that I'm exactly the same as above. |
Ok, think I've spotted it. When I had the Rails::Engine pointing towards '/admin' and the devise_for :admins the model the route it was attempting to go to was /admins/sign_in which was trying to hit this
So it looks like Rails Admin is greedily grabbing anything with the word /admin in it's path. As soon as I changed the rails admin path to /cms everything worked fine. |
What if you put RA route after devise :admins? |
I just tried out the suggestion by @pollingj and that works great. I spotted a similar message in the server logs but mine was: Processing by RailsAdmin::MainController#show as HTML
Parameters: {"model_name"=>"_users", "id"=>"sign_in"} I assumed the _users was how rails_admin worked. Anyway, I've also moved the RA route so it's under the devise route and that also works with /admin. Thanks guys for the help :o) |
Ok, not a RA issue, then.. Just the way Rack::Mount works. I thought it would match /admin/ instead of /admin... |
I've just run with the same issue when using |
I have this in devise_for :users
devise_for :staff, :class_name => 'User::Staff'
devise_for :customers, :class_name => 'User::Customer'
mount RailsAdmin::Engine => '/admin', :as => 'rails_admin'
How to use |
Got it! Should use this code: devise_for :staff, :class_name => 'User::Staff'
devise_for :customers, :class_name => 'User::Customer'
devise_for :users
mount RailsAdmin::Engine => '/admin', :as => 'rails_admin' RA uses the first |
Awesome, thanks for posting this. |
Suffered from same problem, @iRonin's simple solution to switch lines helped me. I've added this info to the Troubleshooting wiki |
Yeah, I got this problem too. @iRonin's solution works! Thank you. |
Hi all,
I've just installed rails_admin for the first time and have hit a bit of a snag. After installation I go to /admin and I end up in a redirection loop. When Chrome displays the error the url in the address bar is: /admin_users/sign_in
Firstly, during the install I had a problem with Devise. I think the
gem 'devise'
line was added to the end of my gemfile but without a new line and so it was appended to and closing blockend
(eg:endgem 'devise'
) which caused problems for the rails_admin install process. I got through that and updated devise manually afterwards.I'm also user a custom user model of
admin_user
as I already have a user model that I don't want to allow access to rails_admin.I haven't done any other customization from the default install. But I get the redirection loop if I go to /admin. I've checked over everything and it all looks good (as far as I can tell).
I can get it to work if I edit the rails_admin initializer to include an empty
config.authenticate_with
block. But of course this means there isn't any authentication and anyone can see the admin panel.Any ideas to point me in the right direction? This might be related to the failed initial install but I think I covered everything.
Thanks in advance
Andy
The text was updated successfully, but these errors were encountered: