Davide Spaggiari wrote:
>> That is true, yes.
<snip>
> So, if i don't specify a method (as we did), the default one would be
> POST ??
> Or DELETE ??
> Or PUT ??
>
> Which one ??
Sorry for being a little unclear but this was my point: Rails will NOT
try to guess which method you want and there is no default. In other
words, since we don't only use GET now, we have to tell Rails which one
to use (no matter if it's GET, POST, PUT or DELETE).
map.resources :questions, :collection => {:arg => :get}
In the example above we pass an option called :collection that specifies
which custom actions that is going to affect a _collection_ of (in your
case) questions. Then we define one custom action ("arg") that is going
to use the GET method. See the point? :arg => :get
The collection option accepts a hash with action name as key and method
name (GET, POST, PUT, DELETE) as value, so there is no default. Also
remember that if you want to make an action that is only going to affect
_one_ question you'll want to use the :member option instead, like this:
map.resources :questions, :collection => {:arg => :get}, :member =>
{:affecting_one_question => :get}
Hope that helped. (:
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---