Ruby on Rails: rails generating controller do not work

I am new to ruby ​​and rails and am having a problem with controller generators.

In some context:

$ rails -v
Rails 4.1.1

The application was created correctly:

$ 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

The server is working fine:

$ 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 view the default page, but then when I try to go to the next step, this will not work:

$ rails generate controller welcome index

Nothing happens and no files are generated. This is not an option, so I don’t know where I should look for a fix.

I already tried to create a new new application and reinstall the rails, but this does not help.

+6
source share
5 answers

Try to run

spring stop

rails generate may not work because spring is already running.

+33
source

Windows rails generate controller Users new.

, spring . spring stop

THEN:

  • Gemfile : gem 'spring' and gem 'spring-watcher-listen', '~> 2.0.0'
  • : bundle update
+1

spring stop, , .

bundle install, ..

0

6 .

0

. ctl-c, :

/usr/local/rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/client/run.rb:54:in `gets': Interrupt
from /usr/local/rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/client/run.rb:54:in `verify_server_version'
from /usr/local/rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/client/run.rb:25:in `call'
from /usr/local/rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
from /usr/local/rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/client/rails.rb:23:in `call'
from /usr/local/rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
from /usr/local/rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
from /usr/local/rvm/gems/ruby-2.1.0/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
from /usr/local/rvm/gems/ruby-2.1.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/yapo/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

, , - spring. spring Gemfile, bundle update voila. , .

, - , / ?

-1
source

Source: https://habr.com/ru/post/1543655/


All Articles