Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
304 views
in Technique[技术] by (71.8m points)

ruby on rails 3 - Why is my development server not loading? default_controller_and_action': missing :action (ArgumentError)

I'm a Ruby nuby (and new to Stack Overflow) working on the Rails Tutorial by Michael Hartl and all of a sudden my development server won't load and keeps exiting. Console also won't load and Rspec spec/ produces errors/exceptions. I am including some output from the terminal, your help is much appreciated.

Exiting
/Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:164:in `default_controller_and_action': missing :action (ArgumentError)
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:68:in `normalize_options!'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:51:in `initialize'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:261:in `new'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:261:in `match'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:1112:in `match'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:1297:in `match'
    from /Users/ameedachowdhury/rails_projects/railstutorial/config/routes.rb:11:in `block in <top (required)>'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/route_set.rb:233:in `instance_exec'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/route_set.rb:233:in `draw'
    from /Users/ameedachowdhury/rails_projects/railstutorial/config/routes.rb:1:in `<top (required)>'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `block in load'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `block in load_dependency'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:127:in `block in reload_routes!'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:127:in `each'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:127:in `reload_routes!'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:120:in `block in routes_reloader'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/file_update_checker.rb:32:in `call'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application/finisher.rb:51:in `block (2 levels) in <module:Finisher>'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application/finisher.rb:52:in `call'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application/finisher.rb:52:in `block in <module:Finisher>'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `block in run_initializers'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
    from /Users/ameedachowdhury/rails_projects/railstutorial/config/environment.rb:5:in `<top (required)>'
    from /Users/ameedachowdhury/rails_projects/railstutorial/config.ru:3:in `require'
    from /Users/ameedachowdhury/rails_projects/railstutorial/config.ru:3:in `block in <main>'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    from /Users/ameedachowdhury/rails_projects/railstutorial/config.ru:1:in `new'
    from /Users/ameedachowdhury/rails_projects/railstutorial/config.ru:1:in `<main>'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rack-1.2.1/lib/rack/builder.rb:35:in `eval'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rack-1.2.1/lib/rack/builder.rb:35:in `parse_file'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rack-1.2.1/lib/rack/server.rb:162:in `app'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rack-1.2.1/lib/rack/server.rb:248:in `wrapped_app'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rack-1.2.1/lib/rack/server.rb:213:in `start'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/commands/server.rb:65:in `start'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/commands.rb:30:in `block in <top (required)>'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/commands.rb:27:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
ameeda-chowdhurys-macbook:railstutorial ameedachowdhury$ 

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

When I ran into this problem, it was because one of the routes in routes.rb had a slash (/) instead of the hash (#) when using the controller#action syntax (I used "controller/action", which was incorrect).

For example, I accidentally had root :to => 'home/index'. It was supposed to be root :to => 'home#index'.

I found this solution in here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...