I'm having trouble with a route that seems to be right in the console but gives me a routing error when I use it in the server. The case is similar to the "edit" and "update" pair. Calling GET 'messages/25/followup' should route to messages#followup, while the same URL with POST should route to messages#followup_send. In my routes.rb file I have
get "messages/:id/followup", :to => "messages#followup"
match "messages/:id/followup", :to => "messages#followup_send", :via => :post
Displaying the routes gives
ruby-1.9.2-p0 :092 > puts fu
GET /messages/:id/followup(.:format) {:controller=>"messages", :action=>"followup"}
POST /messages/:id/followup(.:format) {:controller=>"messages", :action=>"followup_send"}
Testing in the console gives
ruby-1.9.2-p0 :088 > r.recognize_path "/messages/54/followup", :method=>'POST'
=> {:controller=>"messages", :action=>"followup_send", :id=>"54"}
The code in the form is
<form id="edit_message_42" class="edit_message" method="post" action="/messages/42/followup?method=post" accept-charset="UTF-8">
...
<input type="submit" value="Send" name="commit">
However, if I click on the button I get in the log
Started POST "/messages/42/followup?method=post" for 127.0.0.1 at 2012-06-27 13:54:48 +0100
ActionController::RoutingError (No route matches "/messages/42/followup")
The same thing happens if I enter the URL manually (including the "method=post'). I will just get around this for now by using a separate name (e.g. /messages/42/send_followup) rather than relying on the GET-POST distinction, but I would like to understand what is going on here.
Thanks for any ideas.