[Rails] 0.10.0, Routes and Query strings

corey johnson probablycorey at gmail.com
Tue Mar 15 04:17:08 GMT 2005


So I made the leap to 0.10.0 but I can not get routes to play nice
with query strings...

I have this mapping in my routes.rb file
map.connect ':controller/:action/:id', :controller => 'main_controller'

This is all cool and everything works fine http://www.siteroot.com/
maps to http://www.siteroot.com/main_controller/index

But when I add a query string to the end like this...
http://www.siteroot.com/?offset=10
...the poop hits the fan

And I get this stacktrace in my error.log
/Library/WebServer/sidewayspony/public/../config/..//vendor/activesupport/lib/active_support/core_ext/hash/keys.rb:27:in
`symbolize_keys': undefined method `to_sym' for nil:NilClass
(NoMethodError)
        from /Library/WebServer/sidewayspony/public/../config/..//vendor/activesupport/lib/active_support/core_ext/hash/keys.rb:26:in
`inject'
        from /Library/WebServer/sidewayspony/public/../config/..//vendor/activesupport/lib/active_support/core_ext/hash/keys.rb:26:in
`each'
        from /Library/WebServer/sidewayspony/public/../config/..//vendor/activesupport/lib/active_support/core_ext/hash/keys.rb:26:in
`inject'
        from /Library/WebServer/sidewayspony/public/../config/..//vendor/activesupport/lib/active_support/core_ext/hash/keys.rb:26:in
`symbolize_keys'
        from /Library/WebServer/sidewayspony/public/../config/..//vendor/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb:5:in
`initialize'        from
/Library/WebServer/sidewayspony/public/../config/..//vendor/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb:33:in
`new'
        from /Library/WebServer/sidewayspony/public/../config/..//vendor/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb:33:in
`with_indifferent_access'
        from /Library/WebServer/sidewayspony/public/../config/..//vendor/actionpack/lib/action_controller/request.rb:7:in
`parameters'
        from /Library/WebServer/sidewayspony/public/../config/..//vendor/actionpack/lib/action_controller/base.rb:659:in
`assign_shortcuts'
        from /Library/WebServer/sidewayspony/public/../config/..//vendor/actionpack/lib/action_controller/base.rb:319:in
`process'
        from /Library/WebServer/sidewayspony/public/../config/..//vendor/actionpack/lib/action_controller/rescue.rb:20:in
`process_with_exception'
        from /Library/WebServer/sidewayspony/public/../config/..//vendor/railties/lib/dispatcher.rb:34:in
`dispatch'
        from /Library/WebServer/sidewayspony/public/dispatch.cgi:10

Back in 0.9x.0 everything worked fine. Is there a way to get query
strings in routes to work like mod_rewrite?

Thanks,
Corey

P.S. David is my hero!


More information about the Rails mailing list