开发者

heroku & devise user sign up registration controller error

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::Reg开发者_如何学运维istrationsController

  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.


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.


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜