map.resources with both :get and :post on an action

using map.resources i want an action to have both :get and :post http

map.resources :tickets,
  :path_prefix => '/workflows,
  :collection => { :pending => [:get, :post],
    :download => :get }

here the pending action responds to post, i think the route was
I can use :any as the HTTP verb but i want the route to be more
I am using rails 2.1.1.

when i try to access
'/workflows/tickets/pending' i get a Routing Error.
No route matches "/workflows/tickets/pending" with {:method=>:get}

Please Help


does { :pending => :any} work? Being able to specify multiple discrete
methods was an addition in 2.3 I believe.


{ :pending => :any} worked but then i had to write.

if request.get?
  # .......
  # .......
            "Route #{request.path} is valid for get or post, not for #

I wanted to specify this in the route.rb and make it more

How do is specify this using the routes DSL?

the 'pending action' shows a list of tickets, we apply some filters on
them like from and to date and other filters.
Then i have to process this ticket, wherein we contact an external
api, some db transactions and generate a csv report.

i would like to POST to the same url to process the tickets as
selected on the GET.
The get request is Idempotent and can be done as many times as needed,
but the POST request is destructive. I am not very good at REST
principles but this is RESTful i believe.

In the older rails scaffolding, if i remember correct, the new and
save action was the same but we GET or POSTed on that action. In
RESTful rails we have a new action with the GET http verb and a save
action with POST, is this more idiomatic rails to have one action with
either GET or POST but not both? Even if it is not the rails way, how
would i express it in rails routes DSL.

Basically, it is a workflow with multiple steps. Tentatively what i
have thought about is that every step is an action. We GET the action
and POST to the same action after which we are redirected to another
action. A better solution or an example of a good piece of code would
be nice.


You have to specify different actions in your controller for get and
post. Then in routes.rb you can declare the same url to get routed to
either one of these actions depending on the http verb.