password无法加载这样的文件

password无法加载这样的文件

本文介绍了Rails has_secure_password无法加载这样的文件 - bcrypt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我试图在Ruby on Rails中创建简单的身份验证。

我目前陷入困境,因为在数据库中创建表并添加模型

在> windows 10

第1步

  gem uninstall bcrypt 
gem uninstall bcrypt-ruby

第2步

  gem install bcrypt --platform = ruby​​ 

第3步

添加到您的Gemfile中

  gem'bcrypt',平台::ruby 

设计



如果您使用设计,那么不需要广告d在您的gem文件上加密宝石,请按照以下步骤操作:

  gem卸载bcrypt 
gem install bcrypt --platform = ruby​​

最后,重新启动服务器



帮助


I'm trying to create simple authentication in Ruby on Rails.
I'm currently stuck, because after creating table in database and adding in model has_secure_password I'm getting error LoadError: cannot load such file -- bcrypt.
The error occur when I'm trying in rails console using basic command: User.all.

I have looked at many solutions but nothing helped me.
Currently I have installed bcrypt from https://github.com/codahale/bcrypt-ruby.git but still not working.

Thank you in advance for your help.

解决方案

On windows 10 I I solved this using this steps

Step 1.

gem uninstall bcrypt
gem uninstall bcrypt-ruby

Step 2

gem install bcrypt --platform=ruby

Step 3

Add to your Gemfile

gem 'bcrypt', platforms: :ruby

devise

If you use devise then not need add bcrypt gem on your gem file follow below steps

gem uninstall bcrypt
 gem install bcrypt --platform=ruby

Finally, restart your server

Hope to help

这篇关于Rails has_secure_password无法加载这样的文件 - bcrypt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 11:30