Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

"rails server" say "default_controller_and_action" : missing ...

#5747

Hi gang,

--- my conf ----- Rails 3.0.

Windows 7.

--- description ---- I just create a new app, generating models, creating a standalone database migration to add data (encoded in utf-8), running it no problems.
Then, I've generate a controller :

rails generate controller home index creer .... all good.

I've updated routes.rb to have the root pointing to home#index AND deleted public/index.html.

So I want to check it :

rails server

I've uploaded the entire application for you guys to check it out. I'm new to rails 3.0, so I may be missing something.... though I don't know what.

--- error & stacktrace---- Command :

rails server succeed but fails after ~3 seconds, saying :

E:\rails-projects\mescliques-poc>rails server
=> Booting WEBrick => Rails 3.0.0 application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server Exiting
C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/routing/mapper.rb:147:in default_controller_and_action': missing :controller (ArgumentError)<br/>

    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/routing/mapper.rb:68:in `normalize_options!'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/routing/mapper.rb:50:in `initialize'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/routing/mapper.rb:234:in `new'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/routing/mapper.rb:234:in `match'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/routing/mapper.rb:716:in `match'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/routing/mapper.rb:928:in `match'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/routing/mapper.rb:312:in `map_method'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/routing/mapper.rb:262:in `get'
    from E:/rails-projects/mescliques-poc/config/routes.rb:7:in `block in <top (required)>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/routing/route_set.rb:233:in `instance_exec'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/routing/route_set.rb:233:in `draw'
    from E:/rails-projects/mescliques-poc/config/routes.rb:1:in `<top (required)>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `load'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `block in load'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block in load_dependency'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `load'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/application.rb:127:in `block in reload_routes!'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/application.rb:127:in `each'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/application.rb:127:in `reload_routes!'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/application.rb:120:in `block in routes_reloader'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/file_update_checker.rb:32:in `call'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/railtie.rb:14:in `block (2 levels) in <class:Railtie>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:419:in `_run_prepare_callbacks'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/middleware/callbacks.rb:40:in `initialize'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/middleware/stack.rb:33:in `new'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/middleware/stack.rb:33:in `build'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/middleware/stack.rb:79:in `block in build'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/middleware/stack.rb:79:in `each'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/middleware/stack.rb:79:in `inject'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/middleware/stack.rb:79:in `build'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/application.rb:162:in `app'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/application/finisher.rb:35:in `block in <module:Finisher>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `instance_exec'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `run'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/initializable.rb:50:in `block in run_initializers'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `each'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `run_initializers'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/application.rb:134:in `initialize!'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/application.rb:77:in `method_missing'
    from E:/rails-projects/mescliques-poc/config/environment.rb:5:in `<top (required)>'
    from E:/rails-projects/mescliques-poc/config.ru:3:in `require'
    from E:/rails-projects/mescliques-poc/config.ru:3:in `block in <main>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    from E:/rails-projects/mescliques-poc/config.ru:1:in `new'
    from E:/rails-projects/mescliques-poc/config.ru:1:in `<main>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:35:in `eval'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:35:in `parse_file'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:162:in `app'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:248:in `wrapped_app'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:213:in `start'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands/server.rb:65:in `start'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:30:in `block in <top (required)>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:27:in `tap'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:27:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

E:\rails-projects\mescliques-poc>

Reported by Marcel Fallier · October 1st, 2010 @ 02:43 PM

State: invalid
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Marcel Fallier
    Marcel Fallier
    • No changes were found…

    October 1st, 2010 @ 02:49 PM

  2. Marcel Fallier
    Marcel Fallier

    Hi again,

    is it because a controller cannot have an action with a dash, like :

    generate controller home index recup-password

    ?

    Sorry?

    October 1st, 2010 @ 02:50 PM

  3. Marcel Fallier
    Marcel Fallier

    It's seems that's the cause.

    Sorry, this ticket can be closed (soso sorry)

    October 1st, 2010 @ 02:52 PM

  4. Ken Vogt
    Ken Vogt

    I am having the same problem and I am using no dashes. I get the following error both from "rails server" and from "rails generate controller...":

    /Library/Ruby/Gems/1.8/gems/actionpack-3.0.0/lib/action_dispatch/routing/mapper.rb:147:in default_controller_and_action': missing :controller (ArgumentError)

    October 7th, 2010 @ 11:34 PM

  5. David Trasbo
    David Trasbo
    • Importance changed from to Low

    Ken, please post your routes.rb. This error most likely has to do with misuse of the new routing DSL - I've had the error myself a couple of times.

    October 8th, 2010 @ 08:52 AM

  6. Ken Vogt
    Ken Vogt

    After further investigation, this is just a symptom of a bigger issue. I am going to open a separate ticket so the subject line will be searchable by others.

    October 11th, 2010 @ 09:22 PM

  7. Ryan Bigg
    Ryan Bigg
    • State changed from new to invalid

    Ken Vogt, you never opened the other ticket.

    To my knowledge, this issue would occur with an invalid routes.rb file. Closing it because it seems to be User Error.

    October 11th, 2010 @ 10:26 PM