Post method map.resources

Sorry if this is a really basic question but I can't seem to add my own action that works through a post method. I've tried :new, :create, :collection, :member, etc without any success it seems to automatically take you to create or show as soon as it senses a post (get mappings work just fine!)

TIA

Taken from… http://api.rubyonrails.org/classes/ActionController/Routing.html >> Route conditions

With conditions you can define restrictions on routes. Currently the only valid condition is :method.

  • :method - Allows you to specify which method can access the route. Possible values are :post, :get, :put, :delete and :any. The default value is :any, :any means that any method can access the route. Example:
map.connect 'post/:id', :controller => 'posts', :action => 'show',
              :conditions => { :method => :get }
  map.connect 'post/:id', :controller => 'posts', :action => 'create_comment',

              :conditions => { :method => :post }

Now, if you POST to /posts/:id, it will route to the create_comment action. A GET on the same URL will route to the show action.

or if you are using a resource… from http://api.rubyonrails.org/classes/ActionController/Resources.html

map.resources :messages, :collection => { :rss => :get }
  # --> GET /messages/rss (maps to the #rss action)
  # also adds a named route called "rss_messages"

  map.resources :messages, :member => { :mark => :post }

  # --> POST /messages/1/mark (maps to the #mark action)
  # also adds a named route called "mark_message"