Hi Everyone -
I think I may have found a problem with the Routes in Rails 0.10. I
have a controller called "survey" with a "list" action that
does
pagination of a list of surveys filled out by users. So to view page 2
of the listing, the URL is something like
http://foo/survey/list?page=2
I upgraded the app to Rails 0.10 and everything was working great until
I added a custom Route. Here''s the whole routes.rb:
ActionController::Routing::Routes.draw do |map|
map.connect '''', :controller =>
''survey'', :action => ''list''
map.connect '':controller/:action/:id''
end
So now the URL http://foo/ correctly shows the output of my survey
controller''s list action. Great.
However, the URL that the pagination helper generates for page 2 of the
listing is now
http://foo/?page=2
When I follow this link, I get a 500 response from Apache and the
following in apache.log:
[Mon Feb 28 16:40:53 2005] [debug] mod_rewrite.c(1643): [client
127.0.0.1] mod_rewrite''s internal redirect status: 0/10.
/usr/lib/ruby/gems/1.8/gems/activesupport-1.0.0/lib/active_support/
core_ext/hash/keys.rb:27:in `symbolize_keys'': undefined method
`to_sym''
for nil:NilClass (NoMethodError)
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.0.0/lib/active_support/
core_ext/hash/keys.rb:26:in `inject''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.0.0/lib/active_support/
core_ext/hash/keys.rb:26:in `each''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.0.0/lib/active_support/
core_ext/hash/keys.rb:26:in `inject''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.0.0/lib/active_support/
core_ext/hash/keys.rb:26:in `symbolize_keys''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.0.0/lib/active_support/
core_ext/hash/indifferent_access.rb:5:in `initialize''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.0.0/lib/active_support/
core_ext/hash/indifferent_access.rb:33:in `new''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.0.0/lib/active_support/
core_ext/hash/indifferent_access.rb:33:in `with_indifferent_access''
from
/usr/lib/ruby/gems/1.8/gems/actionpack-1.5.0/lib/action_controller/
request.rb:7:in `parameters''
from
/usr/lib/ruby/gems/1.8/gems/actionpack-1.5.0/lib/action_controller/
base.rb:659:in `assign_shortcuts''
from
/usr/lib/ruby/gems/1.8/gems/actionpack-1.5.0/lib/action_controller/
base.rb:319:in `process''
from
/usr/lib/ruby/gems/1.8/gems/actionpack-1.5.0/lib/action_controller/
rescue.rb:20:in `process_with_exception''
from
/usr/lib/ruby/gems/1.8/gems/rails-0.10.0/lib/dispatcher.rb:34:in
`dispatch''
from
/Users/santry/Development/clg003/survey/public/dispatch.cgi:10
[Mon Feb 28 16:40:58 2005] [error] [client 127.0.0.1] Premature end of
script headers:
/Users/santry/Development/clg003/survey/public/dispatch.cgi
I tried delving into the Rails internals identified in the stack trace,
and quickly got way over my head :-).
Help!
- Sean