ruby-on-railsbcrypt-rubybundle-install

Error while using has_secure_password. cannot load such file -- 2.0/bcrypt_ext


I'm new to Ruby on Rails ans so I'm following the Tutorial Agile Web Development with Rails 4. But on the User Authentification I'm getting an Error which I just can't solve... I've made a Form so the Users can log in and for that I'm using has_secure_password at the file user.rb:

class User < ActiveRecord::Base
    has_secure_password
  validates :name, presence: true, uniqueness: true
end

but when I run the Server i get the error:

cannot load such file -- 2.0/bcrypt_ext

heres the Application Trace

app/models/user.rb:2:in `<class:User>'
app/models/user.rb:1:in `<top (required)>'
app/controllers/users_controller.rb:7:in `index'
This error occurred while loading the following files:
   bcrypt
   bcrypt_ext
   2.0/bcrypt_ext

I have includet gem 'bcrypt-ruby', '~> 3.0.0' in the gemfile but it still don't works.

I've read in similar Questions that it has something to do with "Bundle install" but i can't solve the problem.

Thanks in advance


Solution

  • Definitely,

    gem install bcrypt-ruby 
    

    this will make has_secure_password work. Also remember to restart the rails server after to see the change.