我成功创建了一个Rails应用程序。我的页面加载localhost:3000没有问题。我跑的时候
rails generate controller demo index
它返回
sweet$ rails generate controller demo index
identical app/controllers/demo_controller.rb
route get 'demo/index'
invoke erb
exist app/views/demo
identical app/views/demo/index.html.erb
invoke test_unit
identical test/controllers/demo_controller_test.rb
invoke helper
identical app/helpers/demo_helper.rb
invoke test_unit
invoke assets
invoke js
identical app/assets/javascripts/demo.js
invoke css
identical app/assets/stylesheets/demo.css
但它并没有创建这些文件。我检查了目录,这些目录中不存在文件 这是我所在的目录:
sweet$ pwd
/Users/sweet/dev/simple_cms
这是我的应用根。
我尝试删除整个目录并重新创建应用程序三次。我通过root用户杀死了MySQL中的所有数据库。我跑了bundle install
。每次都成功创建应用程序。
在生成控制器/视图时,是否有人知道Rails存储其逻辑以检查文件是否存在?
答案 0 :(得分:2)
我在Gemfile中注释掉了“spring”,然后运行了
bundle update
bundle install
并重新制作控制器,并且工作正常。
它必须运行我删除的原始应用程序足够“让它运行得更快”。
“Ruby on Rails : rails generate controller does not work”实际上有了答案,但我的症状有点不同,因为我得到了输出。