Devise /users/sign_in redirecting to wrong controller

本秂侑毒 提交于 2019-12-07 12:19:49

问题


Vitals:

  • ruby 1.9.3p194 (2012-04-20 revision 35410)
  • [i686-linux] Rails 3.2.7
  • Devise 2.1.2

The GET /users/sign_in is attempting to redirect to the wrong controller. It has stopped redirecting to wecome#welcome (which works), ans is now redirecting to devise/welcome#welcome, which does not exist and causes a 500 error on the redirect with the following error logged:

ActionController::RoutingError (No route matches {:controller=>"devise/welcome", :action=>"welcome"}):

This started recently, and appears to have been caused by something in a series of gem updates. It used to work perfectly.

Does anybody have any idea why this would start failing ( e.i. which update of which gem) or what I can do about it?

Edits:

Here's the root route from routes.rb:

root :to => "welcome#welcome"

I rolled back to my previous deployment, and the app works again. The deployment was prior to rails 3.2.7.

Gemfile:

source 'http://rubygems.org'

gem 'rails', '~> 3.2.1'
gem 'rake'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'pg'

gem 'devise', '~> 2.1.0'
gem 'devise-encryptable', '~> 0.1.1'
gem 'devise_invitable', '~> 1.0.0'

gem 'haml', "~> 3.1.6"
gem "rdiscount", "~> 1.6.8"
gem 'markaby'

gem 'foreigner', "~> 1.1.5"

gem 'ancestry'
gem 'acts_as_list'

gem 'dynamic_form'
gem 'friendly_id', "~> 4.0.0"


gem 'net-ssh', :git => 'git://github.com/nessche/net-ssh.git'


group :assets do
  gem 'sass-rails',   "~> 3.2.3"
  gem 'coffee-rails', "~> 3.2.1"
  gem 'uglifier', "~> 1.2.3"
end

gem 'therubyracer', "~> 0.10.1"
gem 'jquery-rails', "~> 2.0.1"

gem 'newrelic_rpm', "~> 3.3.1"

gem "marginalia", "~> 1.1.0"


group :development do
  gem 'capistrano', "~> 2.12.0"
  gem 'rvm-capistrano'
#  gem "mail_view", "~> 1.0.1", :git => 'https://github.com/37signals/mail_view.git'
#  gem 'rails_admin'
  gem 'rails-footnotes', '>= 3.7.5.rc4'
  gem 'annotate', '~> 2.4.0'
end

# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
 group :development, :test do
   gem 'webrat'
   gem 'rspec'
   gem 'cucumber'
   gem 'gherkin'
   gem 'spork'
   gem 'spin'
   gem 'capybara'
   gem 'sqlite3'
   gem 'nifty-generators'
   gem 'mocha'
 end

EDIT: 2012-08-27 -
devise 2.1.2 + rails 3.2.6 + journey 1.0.3 = works.
devise 2.1.2 + rails 3.2.6 + journey 1.0.4 = fails.

devise 2.1.2 + rails 3.2.7 + journey 1.0.4 = fails.
devise 2.1.2 + rails 3.2.8 + journey 1.0.4 = fails.

Rails 3.2.7 & 3.2.8, which are security releases require journey 1.0.4. This leaves me pretty well stuck until I can either get a fix for journey.


回答1:


I had a similar problem with Devise routing to an odd place (in my case "devise/authors").

It was broken after a gem bundle update that included journey 1.0.4. I fixed it by locking journey to 1.0.3.




回答2:


I fixed a similar problem by checking the link_to helpers in the site's header, which is shown also on devise sign-up and sign-in pages. Please see the details here.



来源:https://stackoverflow.com/questions/11770494/devise-users-sign-in-redirecting-to-wrong-controller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!