0

有没有人遇到这个问题:

LoadError (cannot load such file -- bcrypt)

在 Rails 5 应用程序中?

我的模型是这样的:

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

我已经捆绑安装了 bcrypt(在我的 Gemfile 中)。我可以在 irb 中使用它,但我的 rails 应用程序出现此错误。

我正在使用 Mac OS X Sierra 和 Ruby 2.3.1。

4

1 回答 1

0

我遇到了同样的错误并重新启动服务器以使其像 Black Enigma 所说的那样工作。即在bundle install终端中运行后,退出您正在运行的服务器,然后rails server再次运行。现在工作正常。

于 2017-09-25T21:21:52.067 回答