Ruby on Rails Friday, July 30, 2010

Hi,

Rails 2.3.4
Ruby 1.8.7

I'm having trouble handling parameters in routes. I want to be able to
handle "?x=1&y=2" style url parameters.

# Here's the route:
map.connect "schools/list/:country/:province/:city",
:controller => "schools",
:action => "list",
:country => nil,
:province => nil,
:city => nil

# This works:

>> rs.recognize_path "/schools/list/US"
=> {:controller=>"schools", :action=>"list", :country=>"US"}

# This doesn't - why not?

rs.recognize_path "/schools/list?country=US"

ActionController::RoutingError: No route matches "/schools/list?
country=US" with {}
from /home/dberger/Repositories/globe_village/vendor/rails/
actionpack/lib/action_controller/routing/recognition_optimisation.rb:
66:in `recognize_path'

I guess I thought Rails handled url parameters automatically. No?

Regards,

Dan

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment