Ruby On Rails 脚手架加载错误
我正在使用我拿起的一本名为“Head First Rails”的书学习 Ruby on Rails,我在第一章,它告诉我使用以下命令创建我的 CRUD
过程:
ruby script/generate scaffold ticket name:string seat_id_seq:string address:text price_paid:decimal email_address:string
我收到的错误是:
ruby:没有这样的文件或目录 -- script/generate (LoadError)
有人可以解释一下我做错了什么吗?我对开发并不陌生,我是一名专业的 C# 开发人员,正在尝试学习 Ruby on Rails。
I am learning Ruby on Rails using a book I picked up called "Head First Rails" I am in the first chapter and it tells me to create my CRUD
procedures using the following command:
ruby script/generate scaffold ticket name:string seat_id_seq:string address:text price_paid:decimal email_address:string
the error I am getting is:
ruby: No such file or directory -- script/generate (LoadError)
Can someone please explain what I am doing wrong. I am not new to development, I am a professional C# developer trying to learn Ruby on Rails.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否在应用程序目录中运行它?需要在应用程序目录中执行scaffold命令才能找到script/generate。
Are you running that in your application directory? The scaffold command needs to be executed in your application directory in order to find script/generate.
尝试在项目目录中简单地使用“./script/generate ...”
try simply "./script/generate ..." in your project directory
这个问题很老了,但是对于任何遇到“Head First Rails”第一版(目前唯一可用的)问题的人来说,它是为 Rails 2 编写的。所以大多数命令,如 script/generate,已被 Rails 3 中的新内容取代。
我建议使用“Agile Web Development with Rails”一书。
This question is old, but for anyone who is having problems with "Head First Rails" first edition (which is the only one available at this time), it was written for rails 2. So most of the commands, like script/generate, have been replaced by new ones in Rails 3.
I suggest using "Agile Web Development with Rails" book.