2

I'm beginner in Ruby on Rails and trying to learn from http://ruby.railstutorial.org/ I'm creating sample_app and got stuck at chapter 6.

My Ruby version: ruby 2.0.0p195 (2013-05-14) [i386-mingw32]

My Rails version: Rails 4.0.0

I have following line in my GemFile:

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

If I type gem list bcrypt-ruby , it shows bcrypt-ruby (3.0.1) . But if I try to create user, I get error saying

You don't have bcrypt-ruby installed in your application. Please add it to your Gemfile and run bundle install

I searched a lot on rails website, bcrypt website & even stackoverflow. But, nothing worked. Please help.

chue x
  • 18,573
  • 7
  • 56
  • 70
Nilesh
  • 21
  • 1
  • 6

6 Answers6

4

I've faced this issue recently (as have many others). As per ladyruby723 posted here, use gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt' in your gemfile file.

weezilla
  • 158
  • 14
1

I solved this the same problem by the following line:

gem 'bcrypt-ruby', '~> 3.1.2'
Jacky
  • 11
  • 1
0

Finally... Got it working. I didn't understand the exact issue but I made two important changes. I'm not sure which change made it working.

  1. I uninstalled my old ruby & rails that were installed from railsinstaller. Installed just ruby for my OS (64 bit which I was not able to choose while installing from railsinstaller). Then I installed rails, sqlite3 separately.

  2. Another important change I did is in Gemfile.lock. I think this did the trick. I kept both of the following lines

    bcrypt-ruby (3.0.0) bcrypt-ruby (3.0.0-x86-mingw32)

Community
  • 1
  • 1
Nilesh
  • 21
  • 1
  • 6
0

I believe this exact issue is solved in another question. There are actually two error messages produced, this being the higher level one, by searching for the lower level I found the below answer.

can't activate bcrypt-ruby (~> 3.0.0), already activated bcrypt-ruby-3.1.1. Make sure all dependencies are added to Gemfile

Community
  • 1
  • 1
KnownColor
  • 449
  • 5
  • 12
0

add below in gem file

gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'

and run bundle install and restart server

him
  • 3,325
  • 3
  • 14
  • 17
0

In my case, the problem was that bcrypt version 3.1.2 was outdated. Fortunately Ruby has a way of installing the most up to date version of a particular gem right from your command line. In this case I typed in

bundle pristine bcrypt

but more generally you can do

bundle pristine gem name

If you think you might be running into a similar issue with a different gem

jjhiggz
  • 49
  • 4