Ruby on Rails:rails 生成控制器不起作用 [英] Ruby on Rails : rails generate controller does not work

查看:37
本文介绍了Ruby on Rails:rails 生成控制器不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 ruby​​ 和 rails 的新手,我在生成控制器时遇到了问题.

I am new to ruby and rails and I am having a problem with generating controllers.

一些上下文:

$ rails -v
Rails 4.1.1

应用已正确创建:

$ rails new test_app
      create
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
[...]
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
         run  bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted

服务器运行良好:

$ rails server
=> Booting WEBrick
=> Rails 4.1.1 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
[2014-06-07 11:12:20] INFO  WEBrick 1.3.1
[2014-06-07 11:12:20] INFO  ruby 1.9.3 (2014-02-24) [x86_64-cygwin]
[2014-06-07 11:12:20] INFO  WEBrick::HTTPServer#start: pid=3340 port=3000

我可以浏览默认页面,但是当我尝试进入下一步时,它失败了:

I can browse the default page, but then when I try to go to the next step, it's failing :

$ rails generate controller welcome index

没有任何反应,也没有生成文件.根本没有输出,所以我不知道应该在哪里解决这个问题.

Nothing happens and the files are not generated. There is not output at all so I don't know where I should look to fix the issue.

我已经尝试创建一个全新的应用程序并重新安装 rails,但这无济于事.

I already tried creating a fresh new app and reinstalling rails, but this doesn't help.

推荐答案

尝试运行

spring stop

rails generate 可能无法工作,因为 spring 已经在运行.

rails generate may not work because spring is already running.

这篇关于Ruby on Rails:rails 生成控制器不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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