heartcombo / devise

Flexible authentication solution for Rails with Warden.
http://blog.plataformatec.com.br/tag/devise/
MIT License
23.9k stars 5.54k forks source link

Routes getting ignored on production #1352

Closed tbohr closed 12 years ago

tbohr commented 12 years ago

Hello, i have a big problem with devise! In development mode (we have 5 different systems) the system works fine. We have a "profile" and "admin" model, who use devise. Yesterday we decided to override the session controller - today we try to update our production system with this code but nothing works. The devise_for :profile gets totally ignored. Our routes.rb: .... devise_for :profiles, :controllers => { :registrations => "registrations", :sessions => "sessions", :invitations => "invitations" }, .... namespace :admin do devise_for :admins, :module => "devise", :controllers => { :sessions => "admin/sessions" } do get "login", :to => "admin/sessions#new" get "logout", :to => "admin/sessions#destroy" end end

Versions: Rails 3.0.1 Ruby: 1.9.2p-0 devise (1.2.1, 1.1.7, 1.1.5, 1.1.3, 1.1.rc2) devise-twitter (0.1.1) devise_invitable (0.4.1, 0.3.6, 0.3.5)

devise twitter is not used. on production i updated devise to newest version - but this does not fixed the problem.

i tried lot of things, to get the routes working - no chance.

Can you give me a hint - or does devise has an error logging?

josevalim commented 12 years ago

So a few things may be happening. First, devise-twitter or devise_invitable may be changing devise behavior. In any case, I cannot be sure of what really is happening by just looking at your information. I can try to take a better look if you can isolate the issue in an application and push it to Github.

tbohr commented 12 years ago

On production the same versions are installed as in developing - devise-twiter isn't used.

Is it possible to write the routing by hand? I wondered why devise generates admin routes, but no profile routes.

fotanus commented 11 years ago

I'm stuck in the same problem. I'm not using invitable or twitter.

@tbohr: Do you remember what was your problem?

tbohr commented 11 years ago

Uff, the problem was a gem called "acts_as_archive".

tbohr commented 11 years ago

Uncomment all other gems und try every gem step by step.

fotanus commented 11 years ago

Well, that is quite strange. The problem seems to be with the regexp in this route:

user_omniauth_authorize        /users/auth/:provider(.:format)                    users/omniauth_callbacks#passthru {:provider=>/(?!)/}

Instead of this other:

user_omniauth_authorize        /users/auth/:provider(.:format)                    users/omniauth_callbacks#passthru {:provider=>/facebook|google/}

But I can't find the gem causing this - I'm having almost all gems commented in my file (attached). I'll open other issue for this, I guess.

Gemfile (removing anything else make rake routes fail):

source 'https://rubygems.org'

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

#group :assets do
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
#end

#group :development do
  gem 'debugger'
  gem 'rspec-rails'
  gem 'rspec-expectations'
  gem 'rspec-mocks'
  gem 'factory_girl'
#end

gem 'sass-rails',   '~> 3.2.3'
#
#gem 'jquery-rails', '2.0.3'
#gem 'bcrypt-ruby', '~> 3.0.0'
#
#gem 'therubyracer'
#gem 'execjs'
gem 'pg'

#gem 'capistrano'
#gem 'rvm-capistrano'
#gem 'haml'
#gem 'haml-rails'
#gem 'nested_form'
#gem 'jquery-ui-rails'
#gem 'tinymce-rails'
#gem 'tinymce-rails-langs'

gem 'rmagick'
gem 'devise'
gem 'carrierwave'
#gem 'omniauth'
gem 'omniauth-facebook'
gem 'omniauth-openid'
#gem 'validates_email_format_of'
#gem 'thinking-sphinx', '2.0.10'
#gem 'will_paginate'
#gem 'geocoder'
#gem 'cells'
#
#gem 'rsocialize'
josevalim commented 11 years ago

Does it happen in a new application? Opening a new issue is not going to help if we don't have a way to reproduce the issue.

fotanus commented 11 years ago

That is ok, my mistake - While tracing down the error to open an issue, I found that I didn't configured devise for production environment. So I had something like this in the initializer:

Devise.setup do |config|
  if Rails.env != "production"
    config.omniauth :facebook, xxxxx
    config.omniauth :open_id, xxxx
   end
   ...
end

So it returns the unmatchable regexp when there is nothing configure on omniauth, as expected.

Thanks, sorry for the noise.