2

I just switched to Devise/Omniauth combo and everything is working properly on my localhost server. However when I uploaded to heroku the app crashes when the user clicks sign up on the traditional sign up form (not omniauth login). I am using rails 3. My logs say

LoadError (no such file to load --bcrypt): app/controllers/registrations_controller.rb:11 in 'build_resource' app/controllers/registrations_controller.rb:4 in create'

The referenced controller:

class RegistrationsController < Devise::RegistrationsController

  def create
    super
    session[:omniauth] = nil unless @user.new_record?
  end

  private

  def build_resource(*args)
    super
    if session[:omniauth]
      @user.apply_omniauth(session[:omniauth])
      @user.valid?
    end
  end 
end

Line 4 and 11 are the super since the registration controller is overriding Devise. What's going wrong? Thanks.

John
  • 4,362
  • 5
  • 32
  • 50

2 Answers2

6

Make sure you have:

gem 'bcrypt-ruby'

in your Gemfile. If not, add it and run

bundle install

Also, you may have to delete your Gemfile.lock and try to push to Heroku again.

David
  • 7,310
  • 6
  • 41
  • 63
  • Thank you. It did require deleting Gemfile.lock to get it to install, but it is now working. – John Feb 01 '11 at 19:02
1

I had the same problem running the Omniauth railscast on heroku.

gem 'bcrypt-ruby'

Did the trick and no need to delete Gemfile.lock. I also needed:

heroku stack:migrate bamboo-mri-1.9.2
jacob
  • 11
  • 1