0

rake ルートを実行すると、次のようになります。

rake aborted!
missing :controller
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:229:in `default_controller_and_action'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:116:in `normalize_options!'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:64:in `initialize'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `new'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `add_route'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1417:in `decomposed_match'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1398:in `block in match'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `match'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:596:in `map_method'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:557:in `get'
/Users/mlegacy/Documents/RubyProjects/relaunchradio/config/routes.rb:5:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `instance_exec'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `eval_block'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:294:in `draw'
/Users/mlegacy/Documents/RubyProjects/relaunchradio/config/routes.rb:1:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `load_paths'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:16:in `reload!'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:26:in `block in updater'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `execute'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:27:in `updater'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/mlegacy/Documents/RubyProjects/relaunchradio/config/environment.rb:5:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'
Tasks: TOP => routes => environment
(See full trace by running task with --trace)

ここに私のルートファイルがあります:

Blog::Application.routes.draw do 

  root to: 'home#index2'

  get "sessions#new"
  resources :users

  get "pitchme", to: "pitchme#index", as: "pitchme"

  get "gregg", to: "gregg#index", as: "gregg"
  get "webleads", to: "webleads#index", as: "webleads"
  get "connect", to: "connect#index", as: "connect"
  get "home", to: "home#index", as: "home"
  mount Ckeditor::Engine => '/ckeditor'

  get "posts#new"

  resources :posts

  get 'signup', to: 'users#new', as: 'signup'
  get 'login', to: 'sessions#new', as: 'login'
  get 'logout', to: 'sessions#destroy', as: 'logout'

  resources :users
  resources :sessions

end

ルートにエラーが見つかりません...何が起こっているのか本当にわかりません。

名前にダッシュが含まれるアクションを含むコントローラーを生成しましたが、それが問題であることがわかりましたが、それらのページとコントローラーを削除しましたが、まだうまくいきません。これはとてもイライラします。

楽しみのために、ここに Rails s のトレースを示します。

    => Booting WEBrick
    => Rails 4.0.0 application starting in development on http://0.0.0.0:3000
    => Run `rails server -h` for more startup options
    => Ctrl-C to shutdown server
    Exiting
    /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-   4.0.0/lib/action_dispatch/routing/mapper.rb:229:in `default_controller_and_action': missing   :controller (ArgumentError)
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:116:in `normalize_options!'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:64:in `initialize'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `new'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `add_route'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1417:in `decomposed_match'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1398:in `block in match'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `each'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `match'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:596:in `map_method'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:557:in `get'
        from /Users/mlegacy/Documents/RubyProjects/relaunchradio/config/routes.rb:5:in `block in <top (required)>'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `instance_exec'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `eval_block'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:294:in `draw'
        from /Users/mlegacy/Documents/RubyProjects/relaunchradio/config/routes.rb:1:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `each'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `load_paths'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:16:in `reload!'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:26:in `block in updater'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `call'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `execute'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:27:in `updater'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/tsort.rb:150:in `block in tsort_each'
        from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
        from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/tsort.rb:219:in `each_strongly_connected_component_from'
        from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/tsort.rb:182:in `block in each_strongly_connected_component'
        from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/tsort.rb:180:in `each'
        from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/tsort.rb:180:in `each_strongly_connected_component'
        from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/tsort.rb:148:in `tsort_each'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
        from /Users/mlegacy/Documents/RubyProjects/relaunchradio/config/environment.rb:5:in `<top (required)>'
        from /Users/mlegacy/Documents/RubyProjects/relaunchradio/config.ru:3:in `require'
        from /Users/mlegacy/Documents/RubyProjects/relaunchradio/config.ru:3:in `block in <main>'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
        from /Users/mlegacy/Documents/RubyProjects/relaunchradio/config.ru:in `new'
        from /Users/mlegacy/Documents/RubyProjects/relaunchradio/config.ru:in `<main>'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/commands/server.rb:48:in `app'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/commands/server.rb:75:in `start'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/commands.rb:78:in `block in <top (required)>'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

それが指している引数エラーは次のとおりです。

if controller.blank? && segment_keys.exclude?(:controller)
  raise ArgumentError, "missing :controller"
end

しかし、私は空のコントローラーを持っていません....

4

1 に答える 1

0

問題はルートでした。

次の2つでした。

get 'sessions#new'
get 'posts#new'

それらは次のとおりでなければなりません。

get 'sessions/new'
get 'posts/new'

それは迷惑でした。うまくいけば、これはあなたを助けます。

于 2013-09-13T00:42:12.763 に答える