3

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.

Len Jaffe
  • 3,442
  • 1
  • 21
  • 28
  • Can you post some code? My first guess would be that you don't have a home route setup. Also, what version of Rails? – Chris McKnight Aug 02 '12 at 03:19
  • Hmm. Strange. I'm on 3.2.6 and it works fine. Might be related to 3.2.7. Could you post your Gemfile as well to see what other gems you are using? Might be another gem conflicting but I doubt it. – Chris McKnight Aug 02 '12 at 07:11
  • Yeah. after I rolled it back, my production doesn't exhibit this problem, has another. Oddly, after checking out the same branch on my dev box, the problem persists there. So I'm pretty well convinced it is gem interactions. I guess I need to start creating some gemsets/bundles and just back off each update&commit until devise works again... – Len Jaffe Aug 02 '12 at 20:37
  • 1
    Hmm. you don't need rake in your Gemfile since rails will install which version it needs. That could actually be your problem because rake has a newer version. Try changing your rails version to 3.2.6, remove `gem 'rake'` from your Gemfile and do a `bundle update rails` – Chris McKnight Aug 02 '12 at 21:46
  • I removed rake from the gemfile, but that didn't help. I reverted my production install by one release and that appeared to help, but I haven't been able to determine where the bad gem interaction occurs. But I also have not had a huga amount of time to devote to debugging. – Len Jaffe Aug 20 '12 at 15:59
  • Did you update rake and rails? Might have to remove your Gemfile.lock – Chris McKnight Aug 20 '12 at 23:24
  • I did a cap:rollback and that previous production version works. So I checked out that version on my dev box and that one appears to be working. I'm going to write a basket full of tests, and start slowly updating gems until I can determine the culprit gem. I'f I'm lucky, it will be a dev-mode gem that I can live without, and all will be well with the universe again. – Len Jaffe Aug 21 '12 at 17:56
  • A fresh checkout of the 'last-known-good' commit works in my dev env, but as soon as I update rails to 3.2.7 or 3.2.8, devise starts redirecting to the wrong route. Does anybody know of a routing change to rails in 3.2.7, or a fix to devise that I missed when 3.2.7 came out? – Len Jaffe Aug 22 '12 at 13:55
  • You can override the routes that devise redirects to after certain actions such as sign in, sign out, edit profile etc. https://github.com/plataformatec/devise/wiki/How-To:-Customize-the-redirect-after-a-user-edits-their-profile – Chris McKnight Aug 22 '12 at 18:01
  • Also see https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-in-out – Chris McKnight Aug 22 '12 at 18:03
  • Did that, my new_user_session route is being decoded to devise/welcome#welcome instead of welcome#welcome, but only after upgrading from rails 3.2.6 to 3.2.7 or 3.2.8. – Len Jaffe Aug 22 '12 at 23:06
  • Are you sure, you completed this step https://github.com/plataformatec/devise/wiki/How-To:-Customize-the-redirect-after-a-user-edits-their-profile – Jatin Ganhotra Aug 26 '12 at 19:37

2 Answers2

2

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.

  • I updated the original question regarding journey, but you were right about versions, but I can't upgrade to the latest rails security patches. – Len Jaffe Aug 28 '12 at 00:59
  • 1
    See also this: http://stackoverflow.com/questions/11466917/routing-error-when-updating-to-rails-3-2-6-or-rspec-2-11-0 and this: https://github.com/rails/journey/issues/40 – Chris Salzberg Aug 28 '12 at 01:04
  • @shioyama - thank you for the link to the other question. I had seen that one, and while my problem is similar, I am not actively using rspec, so this is all down to rails. So at this point I'm still stuck trying to find out why/where a request for welcome#welcome is being transmogrified into devise/welcome#welcome when journey is upgraded 1.0.4. – Len Jaffe Aug 28 '12 at 16:44
1

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.

Community
  • 1
  • 1
Henry Haverinen
  • 158
  • 1
  • 2