NullVoxPopuli
NullVoxPopuli

Reputation: 65173

trying to upgrade from from ruby 1.8.7 to 1.9.2 while still using rails 2.3.8

when I do bundle exec script/server -p3001, I get the following error / stacktrace =(

/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:142:in `module_eval': (eval):1: syntax error, unexpected '{', expecting ';' or '\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 <top (required)>'
    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 `<top (required)>'
    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 `<top (required)>'
    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 <top (required)>'
    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 `<top (required)>'
    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 `<top (required)>'
    from script/server:3:in `require'
    from script/server:3:in `<main>'

How can I fix this? i mean, the syntax it is pointing at IS really weird... but this worked in 1.8.7 =\

Upvotes: 2

Views: 180

Answers (1)

LuisVM
LuisVM

Reputation: 2793

Check the syntax, I had a similar issue:

syntax error, unexpected '{', expecting ';' or '\n' (SyntaxError)
              def hash_for_{:create=>:post, :delete=>:pos...

where I was sending an array for the :collection key instead of a hash in the routes.rb file. So I had this:

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

and changed to:

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

Hope this helps...

Upvotes: 1

Related Questions