I have Rails 4.0.0 app. When I run bundle install command there is no problem. This is my GemFile.
source \'https://rubygems.org\'
# Bundle edge Rails inste
In console:
$ gem install bundler
$ gem install bcrypt
$ bundle update bcrypt
Remove Gemfile.lock and specify the gem 'bcrypt-ruby', '3.0.0'. Run bundle install
. Actually, in local gem file bcrypt-ruby should be uninstalled.
In your gemfile, you aren't specifying the version, so you're installing the latest version of bcrypt-ruby which is 3.1.1, but what you need is any version from 3.0.0 to 3.0.9. You can get this by adding a version constraint like so:
gem 'bcrypt-ruby', '~> 3.0.0'
The version requirement comes from ActiveModel's SecurePassword which currently has an explicit dependency on bcrypt-ruby (~> 3.0.0). You can see the dependency on github. When this code is executed, it looks for a version 3.0.0 through 3.0.9 which is not installed and so it throws an error.
This dependency was just updated to '~> 3.1.0' a couple of days ago, but has not made its way into the rails activemodel gem yet. When it does, you'll have to update your version accordingly. Here's the commit if you're curious.
I had the same issue, but the current approach provided gem 'bcrypt-ruby', '~> 3.0.0'
didn't work so I actually installed version 3.0.0
adding the line gem 'bcrypt-ruby', '3.0.0'
to Gemfile and installing specific version 3.0.0 (although it should work up to version 3.0.9)
gem install --version='3.0.0' bcrypt-ruby
After this, just verify your bundle install, you can run bundle show bcrypt-ruby
and then you should have the path where this gem was installed, something like
%RUBY_PATH%/lib/ruby/gems/2.0.0/gems/bcrypt-ruby-3.0.0
after these steps I was able to use the bcrypt without problems... just posting this in the event someone still encounters this issue.
Use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'
Had the same issue. Removing the comment # from above line resolved my issue, as jconley mentioned.