tolgap
tolgap

Reputation: 9778

Heroku throws undefined method `devise_for'

I have an app running local, and it works correctly. I've set up devise on it for OAuth with facebook.

When I push the app to Heroku I get this exception:

/app/app/controllers/users_controller.rb:2:in `<class:SessionsController>':
undefined method `devise_for'
for Users::SessionsController:Class (NoMethodError)

But I don't have this error locally.

These are the steps I took after pushing it to Heroku:

So the problem isn't that I still have to restart my server.

Here is my gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.12'

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

gem 'pg'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'
gem 'devise'
gem 'omniauth'
gem 'omniauth-facebook'

What could be the issue?

Edit

Here are the first lines of where the error points at:

# app/controllers/users/users_controller
class Users::SessionsController < Devise::SessionsController
    devise_for :users, :controllers => { :sessions => "users/sessions" }
end

Upvotes: 0

Views: 857

Answers (1)

Leonel Gal&#225;n
Leonel Gal&#225;n

Reputation: 7167

Did you try running this locally? devise_for should be on your routes, not in the controller see https://github.com/plataformatec/devise to make sure you have your settings correctly. You don't need to override the controller, unless you are doing something special with it. If I where you I'll try to do the least amount of change first, and incrementally change it the way you want.

Upvotes: 1

Related Questions