rls*_*saj 0 ruby ruby-on-rails
我的应用程序在本地加载,但任何交互都会引发错误:
Started GET "/users/sign_in" for 127.0.0.1 at 2016-11-22 15:42:14 +1100
ActiveRecord::SchemaMigration Load (1.0ms) SELECT "schema_migrations".* FROM
"schema_migrations"
Processing by Users::SessionsController#new as HTML
Rendering users/sessions/new.html.erb within layouts/application
Rendered users/sessions/new.html.erb within layouts/application (37.0ms)
Rendered layouts/_navbar.html.erb (1.0ms)
Completed 200 OK in 1007ms (Views: 978.5ms | ActiveRecord: 4.0ms)
Started POST "/users/sign_in" for 127.0.0.1 at 2016-11-22 15:42:29 +1100
Completed 401 Unauthorized in 8ms (ActiveRecord: 1.0ms)
Processing by Users::SessionsController#new as HTML
Parameters: {"utf8"=>"V",
Completed 500 Internal Server Error in 4ms (ActiveRecord: 0.0ms)
LoadError (cannot load such file -- bcrypt):
app/controllers/users/sessions_controller.rb:6:in `new'
Rendering C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action
Run Code Online (Sandbox Code Playgroud)
我正在运行Windows7 64位,Ruby23-x64,Rails 5.0.0.1,我安装的唯一bcrypt gem是:bcrypt-3.1.11.
我在这里尝试了解决方案:无法加载这样的文件 - 1.9/bcrypt_ext(LoadError)但bcrypt-ruby不再存在于更新版本的ruby.
编辑:如果我运行gem install bcrypt,我会得到一个额外的bcrypt gem:C:\ Ruby23-x64\lib\ruby\gems\2.3.0\gems.我现在有2个bcrypts:
我要保留哪一个,以及在Gemfile中需要更改哪些内容?
我错过了什么?
你把它gem 'bcrypt'放进你的Gemfile.
如果你把它跑了bundle install,restart你rails server呢?
如果您仍然遇到此问题,可以执行以下操作:
首先卸载bcrypt并bcrypt-ruby运行以下两个命令:
gem uninstall bcrypt 和 gem uninstall bcrypt-ruby
再次安装 gem install bcrypt --platform=ruby
在你的Gemfile写作gem 'bcrypt-ruby', '3.1.5', :require => 'bcrypt'
然后运行bundle install和restart你的rail server