Skip to content

Instantly share code, notes, and snippets.

@carllerche
Created July 23, 2008 03:50
Show Gist options
  • Save carllerche/1516 to your computer and use it in GitHub Desktop.
Save carllerche/1516 to your computer and use it in GitHub Desktop.
Router.prepare do |r|
r.match(:controller => "users") do
r.match("/users/:id", :method => :get).to(:action => "show")
r.match("/users/:id", :method => :put).to(:action => "update")
end
end
# Both routes generate the exact same path, so do we just
# require the minimum necessary to differentiate them?
Router.generate(:id => 10, :method => :get)
Router.generate(:id => 10, :action => :update)
Router.generate(:controller => "users", :action => "show", :id => 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment