2 Stimmen

Versuche, von Ruby 1.8.7 auf 1.9.2 zu aktualisieren, während du immer noch Rails 2.3.8 verwendest

Wenn ich bundle exec script/server -p3001 mache, bekomme ich folgenden Fehler / Stacktrace =(

/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:142:in `module_eval': (eval):1: Syntaxfehler, unerwartetes '{', erwartet ';' oder '\n' (SyntaxError)
              def hash_for_{:build=>[:get, :post]}_templa...
                            ^
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:142:in `named_helper_module_eval'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:152:in `define_hash_access'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:136:in `block in define_named_route_methods'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:134:in `each'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:134:in `define_named_route_methods'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:85:in `add'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:318:in `add_named_route'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:33:in `named_route'
    from [rvm-gemset-location]/gems/activesupport-2.3.8/lib/active_support/option_merger.rb:20:in `method_missing'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:654:in `map_resource_routes'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:606:in `map_default_collection_actions'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:536:in `block in map_resource'
    from [rvm-gemset-location]/gems/activesupport-2.3.8/lib/active_support/core_ext/object/misc.rb:78:in `with_options'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:528:in `map_resource'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:447:in `block in resources'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:447:in `each'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:447:in `resources'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:581:in `map_has_many_associations'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:578:in `block in map_has_many_associations'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:577:in `each'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:577:in `map_has_many_associations'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:560:in `map_associations'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:529:in `block in map_resource'
    from [rvm-gemset-location]/gems/activesupport-2.3.8/lib/active_support/core_ext/object/misc.rb:78:in `with_options'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:528:in `map_resource'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:447:in `block in resources'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:447:in `each'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/resources.rb:447:in `resources'
    from[project directory]/config/routes.rb:45:in `block in '
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:227:in `draw'
    from[project directory]/config/routes.rb:1:in `'
    from [rvm-gemset-location]/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:145:in `load'
    from [rvm-gemset-location]/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:145:in `block in load_with_new_constant_marking'
    from [rvm-gemset-location]/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from [rvm-gemset-location]/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:145:in `load_with_new_constant_marking'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:287:in `block in load_routes!'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:287:in `each'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:287:in `load_routes!'
    from [rvm-gemset-location]/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:267:in `load!'
    from [rvm-gemset-location]/gems/rails-2.3.8/lib/initializer.rb:537:in `initialize_routing'
    from [rvm-gemset-location]/gems/rails-2.3.8/lib/initializer.rb:188:in `process'
    from [rvm-gemset-location]/gems/rails-2.3.8/lib/initializer.rb:113:in `run'
    from[project directory]/config/environment.rb:19:in `'
    from [rvm-gemset-location]/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
    from [rvm-gemset-location]/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `block in require'
    from [rvm-gemset-location]/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from [rvm-gemset-location]/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
    from[project directory]/config.ru:3:in `block in '
    from [rvm-gemset-location]/gems/rack-1.1.3/lib/rack/builder.rb:46:in `instance_eval'
    from [rvm-gemset-location]/gems/rack-1.1.3/lib/rack/builder.rb:46:in `initialize'
    from[project directory]/config.ru:1:in `new'
    from[project directory]/config.ru:1:in `'
    from [rvm-gemset-location]/gems/rails-2.3.8/lib/commands/server.rb:78:in `eval'
    from [rvm-gemset-location]/gems/rails-2.3.8/lib/commands/server.rb:78:in `'
    from script/server:3:in `require'
    from script/server:3:in `

Wie kann ich das beheben? Also, die Syntax, auf die es verweist, ist wirklich merkwürdig... aber das hat in 1.8.7 funktioniert =\

1voto

LuisVM Punkte 2643

Überprüfen Sie die Syntax, ich hatte ein ähnliches Problem:

Syntaxfehler, unerwartet '{', erwartet ';' oder '\n' (SyntaxError)
              def hash_for_{:create=>:post, :delete=>:pos...

wo ich ein Array für den :collection-Schlüssel anstelle einer Hash in der routes.rb-Datei gesendet habe. Also hatte ich dies:

:collection => [ :next => :get, :prev => :get, :sort => :post ]

und geändert zu:

:collection => { :next => :get, :prev => :get, :sort => :post }

Hoffe das hilft...

CodeJaeger.com

CodeJaeger ist eine Gemeinschaft für Programmierer, die täglich Hilfe erhalten..
Wir haben viele Inhalte, und Sie können auch Ihre eigenen Fragen stellen oder die Fragen anderer Leute lösen.

Powered by:

X