23

我在使用script/generate. 我正在关注基于树的导航教程,它说使用script/plugin install git://github.com/rails/acts_as_tree.gitor script/generate nifty_layout

我不断得到:

没有这样的文件或目录 -- 脚本/插件

我尝试了这些变化:

script/generate nifty_layout
rails generate nifty_layout
ruby script/generate nifty_layout
ruby generate nifty_layout

他们都告诉我:

-bash:脚本/生成:没有这样的文件或目录

我错过了什么吗?Total ruby​​ nuby here,我似乎无法找到答案。

编辑:Mac OS X 10.6 上的 rails 3

4

4 回答 4

59

Rails 3 是你的问题(或者更确切地说是原因)。从 rails 3 开始,所有的“script/whatever”命令都被替换为“rails whatever”。

所以现在你想要“rails generate ...”或“rails server”。

在查看教程时请务必注意版本号或发布日期 :) 链接: Rails 3 中缺少脚本/生成

于 2010-12-01T02:59:23.670 回答
2

现在有很多关于 Rails 互联网的过时信息,因为它发展迅速并且非常受欢迎。我使用Ruby on Rails 指南作为获取信息的第一站,因为这些页面似乎是最新的。

rails generate信息似乎是最新的。

于 2010-12-01T03:32:05.503 回答
1

you may try a couple things, first, make sure since you are using rails 3 that you have run 'bundle install'. depending on how you installed rails and which version of bundler you are using, it may not be finding your rails binary to execute the rails generate .. so you may try prefixing it with bundle exec rails g but that is deprecated and you should get a warning if you call it. Also, make sure you are following ryan's instructions for rails 3 (and run bundle install once you add to the gemfile) on his library: https://github.com/ryanb/nifty-generators

于 2010-12-01T03:43:06.937 回答
0

作为 Rails 服务器的快捷方式,您可以使用“rails s”。同样对于控制台,'rails c'。

于 2010-12-01T03:24:57.593 回答