Custom Routes: Determining Action Named Based On Method

Is it possible to create routes that have the same URL yet map to a
different action based on the HTTP method (or pseudo method)?

For example:

map.resources :foo, :collection => { :purge => :get, :purge_them
=> :post }

I’d like to use /foo/purge for both actions, and have the appropriate
controller method called based on the HTTP request’s method -like /foo
does for create and index, amongst others.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs