Älphä Blüë wrote:
> When I'm supplying a :collection symbol it really means that it's just
> adding to the map.resources :rushing_offenses correct?
Yes, an action that works on a collection of the resource.
> And the end
> portion of the map line is stating that whenever I call the method
> :delete, it's going to use the controller method for :destroyall?
>
Nope...
map.resources :rushing_offenses, :collection => {:destroyall => :delete}
defines an additional route that works on the collection of
rushing_offenses.
Your action is destroyall, which is called as an HTTP delete method
> If I'm reading this right, when would I add another map route for
> rushing_offenses or would I just extend that map route by adding other
> hash/blocks?
>
Yup...
http://api.rubyonrails.org/classes/ActionController/Resources.html
you can add additional actions for the collection, and/or additional
actions to operate on individual rushing_offense instances
> Links:
>
> The first segment is just the name of the link as it appears on the
> page.
>
> The second segment is the path to where my custom method exists? I'm
> not sure why the naming of the path was destroyall_rushing_offenses_path
> unless it is structured so that it matches method_controller_path (if so
> then I understand it perfectly).
>
> The third segment was the name of the method we mapped to?
>
> Let me know if I reach a 90% on this tutorial.
>
First segment is the text to render as the link.
Second segment is the 'controller, action' specification. If you're
using the map.resources, then Rails creates handy aliases, like
destroyall_rushing_offenses_path
The old school approach was
<%= link_to 'Destroy All', :controller => 'rushing_offenses', :action =>
'destroyall', :method => :delete %>
Third segment is telling Rails what method you want for the browser
request (can be :get, :put, :post, :delete, or :any)
Follow that link above for more/better info about resource-based
routing.
--
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
-~----------~----~----~----~------~----~------~--~---