尝试加载用户 URL 时 RoR Hartl CH 7 bcrypt 错误 [英] RoR Hartl CH 7 bcrypt error when trying to load Users URL

查看:25
本文介绍了尝试加载用户 URL 时 RoR Hartl CH 7 bcrypt 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 ch.7 在 Hartl RoR 教程中.

I'm at ch. 7 on the Hartl RoR tutorial.

当我尝试加载 url/users/1 时,它应该给我示例用户(我在控制台中成功更新.

When I try to load the url /users/1 it's supposed to give me the Example User (which I successfully updated in console.

相反,我得到了这个错误屏幕:

Instead, I get this error screen:

    LoadError in UsersController#show
    cannot load such file -- bcrypt
        def require(file)
            result = false
            load_dependency(file) { result = super }
            result
          end
        end

Rails.root: /home/ubuntu/workspace

不确定这到底是什么意思.到目前为止,我已经完成了本章和最后一章的所有代码,但似乎无法找到我遗漏的内容.

Not sure what this means exactly. I've gone through all my code so far from this chapter and last, and can't seem to find what I'm missing.

感谢任何帮助,希望对使用本教程的任何其他新手也有帮助.

Any help is appreciated, and hopefully for any other newbie using this tutorial, as well.

谢谢,

蒂姆

推荐答案

看看你的 Gemfile 中是否有这个:

See if you have this in your Gemfile:

gem 'bcrypt-ruby'

如果没有,请添加它.然后运行bundle install进行安装,不要忘记重启服务器.

If not, add it. Then run bundle install to install it and don't forget to restart the server.

教程说要安装它gem 'bcrypt', '3.1.7' 在第 6 章中,但它没有说重新启动服务器.这就是您添加 gem 后通常会执行的操作.

Tutorial says to install it gem 'bcrypt', '3.1.7' in chapter 6, but it doesn't say anything about restart the server. That's what you normally do after adding a gem.

代码清单 6.33:将 bcrypt-ruby 添加到 Gemfile.

https://www.railstutorial.org/book/modeling_users

这篇关于尝试加载用户 URL 时 RoR Hartl CH 7 bcrypt 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆