我试着安装bcrypt来处理密码。
我运行了gem install bcrypt-ruby,得到:
....Successfully installed bcrypt-ruby-3.1.2我添加了gem "bcrypt-ruby", "~> 3.1.2"并运行了bundle install,并重新启动了运行程序的服务器,但是我得到了错误:
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发布于 2014-02-05 16:31:05
~> 3.0.0版本与~> 3.1.2 one冲突,因为比较发生在3.0.~与3.1.~之间,但失败了。为了将~> 3.0.0与3.1进行比较,您可以刮胡子将3.~改为3.1。
如果您无法做到这一点,您必须了解Gemfile.lock,gem需要bcrypt-ruby的3.1.2版本,并尝试将其降低。
发布于 2014-02-05 16:05:07
你可以把Gemfile行改为..。
gem 'bcrypt-ruby', '~> 3.0.0'然后捆绑,这就可以解决它了!
发布于 2014-02-05 16:05:45
试一试
bundle update我还建议简单地将gem "bcrypt-ruby", "3.1.2"放在Gemfile中。
https://stackoverflow.com/questions/21581971
复制相似问题