0

I'm trying to install bcrypt to handle passwords.

I ran gem install bcrypt-ruby and got:

....Successfully installed bcrypt-ruby-3.1.2

I added gem "bcrypt-ruby", "~> 3.1.2" and ran bundle install, and restarted the server which ran the program but I got the error:

get Gem::LoadError in UsersController#new 
can't activate bcrypt-ruby (~> 3.0.0), already activated bcrypt-ruby-3.1.2. Make sure all dependencies are added to Gemfile.


format: { with: VALID_EMAIL_REGEX },
uniqueness: { case_sensitive: false }
**has_secure_password** <---Error
validates :password, length: { minimum: 6 }
end
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Neil
  • 141
  • 2
  • 12

3 Answers3

1

You could change the Gemfile line to...

gem 'bcrypt-ruby', '~> 3.0.0'

and then bundle and that should fix it!

SteveTurczyn
  • 36,057
  • 6
  • 41
  • 53
0

Try

bundle update

I would also recommend simply putting gem "bcrypt-ruby", "3.1.2" in the Gemfile.

beautifulcoder
  • 10,832
  • 3
  • 19
  • 29
0

The ~> 3.0.0 version conflicts with ~> 3.1.2 one, because comparison takes place 3.0.~ to 3.1.~, and failed. You shave to change ~> 3.0.0 to ~> 3.0, in order to compare 3.~ to 3.1.

If you are unable to do it, you have to see into Gemfile.lock, which gem require 3.1.2 version of bcrypt-ruby in, and try to downdrade it.

Малъ Скрылевъ
  • 16,187
  • 5
  • 56
  • 69