耙路线耙子流产! ArgumentError:必须使用路径和/或选项调用

时间:2014-12-15 04:19:05

标签: ruby-on-rails routes

我改变了根:'课程#index'到
root(' lesson #index')

表示错误 /home/govisun/.rvm/gems/ruby-2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/routing/mapper.rb:1504:in root': must be called with a path and/or options (ArgumentError) from /home/govisun/Documents/LessonApp/config/routes.rb:5:in阻止&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/routing/route_set.rb:337:in instance_exec' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/routing/route_set.rb:337:in eval_block&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/routing/route_set.rb:315:in draw' from /home/govisun/Documents/LessonApp/config/routes.rb:1:in&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in load' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in阻止加载&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in load_dependency' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in loading&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:40:in block in load_paths' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:40:in每个&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:40:in load_paths' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:16:in重新加载!&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:26:in block in updater' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/activesupport-4.1.8/lib/active_support/file_update_checker.rb:75:in来电&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/activesupport-4.1.8/lib/active_support/file_update_checker.rb:75:in execute' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:27:in更新程序&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:7:in execute_if_updated' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/application/finisher.rb:71:in阻止&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/initializable.rb:30:in instance_exec' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/initializable.rb:30:in run&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/initializable.rb:55:in block in run_initializers' from /home/govisun/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:226:in阻止tsort_each&#39;     来自/home/govisun/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:348:in block (2 levels) in each_strongly_connected_component' from /home/govisun/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:427:in each_strongly_connected_component_from&#39;     来自/home/govisun/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:347:in block in each_strongly_connected_component' from /home/govisun/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in每个&#39;     来自/home/govisun/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in call' from /home/govisun/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in each_strongly_connected_component&#39;     来自/home/govisun/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:224:in tsort_each' from /home/govisun/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:205:in tsort_each&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/initializable.rb:54:in run_initializers' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/application.rb:300:in初始化!&#39;     来自/home/govisun/Documents/LessonApp/config/environment.rb:5:in <top (required)>' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in要求&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in block in require' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in load_dependency&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in require' from /home/govisun/Documents/LessonApp/config.ru:3:in阻止&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in instance_eval' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in初始化&#39;     来自/home/govisun/Documents/LessonApp/config.ru:in new' from /home/govisun/Documents/LessonApp/config.ru:in&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in eval' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in new_from_string&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in parse_file' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/server.rb:277:in build_app_and_options_from_config&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/server.rb:199:in app' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/commands/server.rb:50:in app&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/server.rb:314:in wrapped_app' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/commands/server.rb:130:in log_to_stdout&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/commands/server.rb:67:in start' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:81:in阻止服务器&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76:in tap' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76:in服务器&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in run_command!' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/railties-4.1.8/lib/rails/commands.rb:17:in&#39;     来自/ home / govisun / Documents / LessonApp / bin / rails:8:require' from /home/govisun/Documents/LessonApp/bin/rails:8:in&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/spring-1.2.0/lib/spring/client/rails.rb:27:in load' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/spring-1.2.0/lib/spring/client/rails.rb:27:in来电&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/spring-1.2.0/lib/spring/client/command.rb:7:in call' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/spring-1.2.0/lib/spring/client.rb:26:in运行&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/spring-1.2.0/bin/spring:48:in <top (required)>' from /home/govisun/.rvm/gems/ruby-2.1.0/gems/spring-1.2.0/lib/spring/binstub.rb:11:in loading&#39;     来自/home/govisun/.rvm/gems/ruby-2.1.0/gems/spring-1.2.0/lib/spring/binstub.rb:11:in <top (required)>' from /home/govisun/Documents/LessonApp/bin/spring:16:in要求&#39;     来自/ home / govisun / Documents / LessonApp / bin / spring:16:<top (required)>' from bin/rails:3:in加载&#39;     来自bin / rails:3:在`&#39;

它起作用了: - )

1 个答案:

答案 0 :(得分:0)

应该是root 'lesson#index'root to: path,如果您要使用(),请确保没有空格root('lesson#index')。查看api了解更多信息。