Why is my development server not loading? default_controller_and_action': missing :action (ArgumentError)

前端 未结 6 2055
我在风中等你
我在风中等你 2020-12-09 08:17

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

6条回答
  •  萌比男神i
    2020-12-09 08:55

    I'm also a Ruby nuby and had the same error while working on the Rails Tutorial by Michael Hartl. If you're like me, you might be just typing in all code that appears in the book with really reading or understanding the text. Not everything is step by step. In demonstrating camel case vs. snake case Hartl shows a box with the following code

    $ rails generate controller static_pages ...
    

    Here, Hartl is simply trying to contrast instructions to generate a StaticPages controller using snake case, rather than camel case, which was done in Listing 3.4. The dots "..." are simply to edit out or truncate the rest of the instructions for the cmd line. I typed in exactly what was shown and wound up with the following in my routes file:

    SampleApp::Application.routes.draw do
     get "static_pages/..."
    
     get "static_pages/home"
    
     get "static_pages/help"
    

    open up your routes file, delete

    get "static_pages/..."
    

    save the routes file, and try starting rails server again.

    I also destroyed "rails generate controller static_pages ..." Not sure if that had any effect, but now everything works.

提交回复
热议问题