rails generate - “找不到生成器" [英] rails generate - "Could not find generator"

查看:39
本文介绍了rails generate - “找不到生成器"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 Michael Hartl 的 Ruby on Rails 教程.在 6.3.1 部分中,我正在尝试生成迁移文件以添加密码字段到我的用户模型.这是我运行的代码:

I am following the Ruby on Rails tutorial by Michael Hartl. In section 6.3.1, I am trying to generate a migration file to add a Password field to my user model. Here is the code that I run:

rails generate add_passsword_digest_to_users password_digest:string

但这会引发错误:Could not find generator add_passsword_digest_to_users.

我之前使用过 rails generate 命令,它运行得很好.我不知道为什么我现在会遇到这个问题.

i have used the rails generate command before and it worked perfectly. I'm not sure why I am getting this problem now.

版本:Rails 3.2.8,ruby 1.9.3p194(2012-04-20 修订版 35410)[x86_64-linux]

version: Rails 3.2.8, ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

推荐答案

尝试:

rails generate migration add_passsword_digest_to_users password_digest:string

你只是忘记了 migration 这是用于其他参数的生成器.

You simply forgot migration which is the generator to use for the other arguments.

这篇关于rails generate - “找不到生成器"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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