我正在嘗試安裝bcrypt來處理密碼。無法激活bcrypt-ruby(〜> 3.0.0),已激活bcrypt-ruby-3.1.2?
我跑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
是否可以將'〜> 3.0.0'改爲'〜> 3.0' –
無法更改 – Neil
您需要在** Gemfile.lock **中看到哪些gem需要3.1.2版本的bcrypt-ruby ,並嘗試降級它。 –