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"
On Sun, Mar 2, 2008 at 1:46 AM, Grayson Piercee <
rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:
>
> 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
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
--
-Robert Ferney ( Kolbe 4357 Demonstrator / Myer Brigs INTJ )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---