【发布时间】:2013-09-08 15:45:27
【问题描述】:
我是 Ruby on Rails 的新手,所以我正在学习使用 Rails 4 进行敏捷 Web 开发教程。但是在用户身份验证中,我遇到了一个我无法解决的错误...... 我制作了一个表格,以便用户可以登录,为此我在文件 user.rb 中使用 has_secure_password:
class User < ActiveRecord::Base
has_secure_password
validates :name, presence: true, uniqueness: true
end
但是当我运行服务器时出现错误:
cannot load such file -- 2.0/bcrypt_ext
这是应用程序跟踪
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
我在 gemfile 中包含 gem 'bcrypt-ruby', '~> 3.0.0' 但它仍然不起作用。
我在类似的问题中读到它与“捆绑安装”有关,但我无法解决问题。
提前致谢
【问题讨论】:
标签: ruby-on-rails bcrypt-ruby bundle-install