[Rails] match default verb
The default verb for match is :any. This means for:
match 'dog/bark(/:num)' => 'dogs#bark' # get 3 barks
match 'dog/eat' => 'dogs#eat' # post breakfast
someone could post on dog/bark with :louder or get on dog/eat
with :breakfast. This is annoying and messy, and definitely not
RESTful.
In moving to Rails 3, I'm finding it better to use the verb instead of
using match with :via => :verb:
get 'dog/bark' => 'dogs#bark'
post 'dog/eat' => 'dogs#eat'
There is a lot of emphasis on match in the routing comments. Wouldn't
it be better to either default to :via => :get for match or recommend
verb methods over the match method?
I want to make sure I understand the differences too.
Thanks in advance,
Mike
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home