简体   繁体   English

Ruby on Rails中的Bcrypt gem

[英]Bcrypt gem in Ruby on Rails

I've just created a fresh Rails 5 application. 我刚刚创建了一个新的Rails 5应用程序。 I don't have any MVC's generated yet inside my application. 我的应用程序内部还没有生成任何MVC。

I added some gems to the gem file including gem 'bcrypt', '3.1.11' . 我在gem文件中添加了一些gem,包括gem 'bcrypt', '3.1.11'

When I try to create a controller with the rails generator, I get an error. 当我尝试使用rails生成器创建控制器时,出现错误。

This is the command with the error that I got: 这是出现错误的命令:

command > rails generate controller StaticPages home help 命令 > rails generate controller StaticPages home help

C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x86-mingw32/lib/bcrypt.rb:16:in `require': cannot load such file -- bcrypt_ext (LoadError)
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x86-mingw32/lib/bcrypt.rb:16:in `rescue in <top (required)>'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x86-mingw32/lib/bcrypt.rb:12:in `<top (required)>'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `require'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `block in require'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `each'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `require'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler.rb:106:in `require'
        from C:/Users/Doesha/Desktop/rails17/rails_sample_app/config/application.rb:7:in `<top (required)>'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:156:in `require'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:156:in `require_application_and_environment!'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:143:in `generate_or_destroy'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:60:in `generate'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands.rb:18:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

All I did was add gems to my gemfile, so I'm not sure why the rails generator isn't working. 我所做的只是将gem添加到我的gemfile中,所以我不确定为什么rails生成器不起作用。

I did notice that my generator stops working when I add the gem bcrypt . 我确实注意到,当我添加gem bcrypt时,生成器停止工作。

Can someone tell me the reason I can't use my generator once I installed gem 'bcrypt', '3.1.11' ? 有人可以告诉我安装gem 'bcrypt', '3.1.11'不能使用生成器的原因吗?

从gem文件中删除gem'bcrypt','3.1.11'并使用$ gem install bcrypt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM