I have a syntax error with Ruby on Rails and I don't seem to be able to solve it:
我在Ruby on Rails上有语法错误,我似乎无法解决它:
/home/francois/.rvm/gems/ruby-2.2.2@global/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:419:in `eval_block': /home/francois/.rvm/gems/ruby-2.2.2@global/gems/actionpack-4.2.0/lib/action_dispatch/routing/mapper.rb:124: syntax error, unexpected ')', expecting => (SyntaxError)
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:439:in `block in clear!'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:439:in `each'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:439:in `clear!'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:35:in `block in clear!'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:33:in `each'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:33:in `clear!'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:15:in `reload!'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/activesupport-4.2.0/lib/active_support/file_update_checker.rb:75:in `call'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/activesupport-4.2.0/lib/active_support/file_update_checker.rb:75:in `execute'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:27:in `updater'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/francois/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /home/francois/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /home/francois/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /home/francois/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/francois/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /home/francois/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /home/francois/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/francois/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /home/francois/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/railtie.rb:194:in `public_send'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/railtie.rb:194:in `method_missing'
from /home/francois/RubymineProjects/sample_app/config/environment.rb:5:in `<top (required)>'
from /home/francois/RubymineProjects/sample_app/config.ru:3:in `require'
from /home/francois/RubymineProjects/sample_app/config.ru:3:in `block in <main>'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/rack-1.6.0/lib/rack/builder.rb:55:in `instance_eval'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/rack-1.6.0/lib/rack/builder.rb:55:in `initialize'
from /home/francois/RubymineProjects/sample_app/config.ru:in `new'
from /home/francois/RubymineProjects/sample_app/config.ru:in `<main>'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/rack-1.6.0/lib/rack/builder.rb:49:in `eval'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/rack-1.6.0/lib/rack/builder.rb:49:in `new_from_string'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/rack-1.6.0/lib/rack/builder.rb:40:in `parse_file'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/rack-1.6.0/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/rack-1.6.0/lib/rack/server.rb:208:in `app'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/commands/server.rb:61:in `app'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/rack-1.6.0/lib/rack/server.rb:336:in `wrapped_app'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/commands/server.rb:139:in `log_to_stdout'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/commands/server.rb:78:in `start'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/app_rails_loader.rb:45:in `require'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/app_rails_loader.rb:45:in `block in exec_app_rails'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/app_rails_loader.rb:34:in `loop'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/app_rails_loader.rb:34:in `exec_app_rails'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/lib/rails/cli.rb:5:in `<top (required)>'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/bin/rails:9:in `require'
from /home/francois/.rvm/gems/ruby-2.2.2@global/gems/railties-4.2.0/bin/rails:9:in `<top (required)>'
from /home/francois/RubymineProjects/sample_app/bin/rails:16:in `load'
from /home/francois/RubymineProjects/sample_app/bin/rails:16:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
The 124th line of mapper.rb is:
mapper.rb的第124行是:
add_request_method(via: [:get, :post], @conditions)
I don't know where the unexpected )
is or maybe the error isn't here. What am I doing wrong?
我不知道意外的地方或者错误不在这里。我究竟做错了什么?
1 个解决方案
#1
If you don't pass hash as last argument, you should wrap it with {}
:
如果你没有传递hash作为最后一个参数,你应该用{}包装它:
add_request_method({ via: [:get, :post] }, @conditions)
#1
If you don't pass hash as last argument, you should wrap it with {}
:
如果你没有传递hash作为最后一个参数,你应该用{}包装它:
add_request_method({ via: [:get, :post] }, @conditions)