On Jun 9, 8:37 pm, “Älphä Blüë” [email protected]
wrote:
<%= link_to “Destroy All”, destroyall_rushing_offenses_path, :confirm =>
Map Routes:
When I’m supplying a :collection symbol it really means that it’s just
adding to the map.resources :rushing_offenses correct? 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?
The rails routing guide covers this sort of stuff. What :collection
does is add actions that apply to the collection (as opposed to ones
added via :member which would apply only to one specific
object). :collection => {:destroyall => :delete} says that the action
you are adding is :destroyall and that the http method that should be
used for requests to this action is DELETE.
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?
You add options etc to the existing one
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).
basically. if you do rake routes you’ll get a list of all the routes
in your app, route_name_path is the helper that gives you the path for
a given route
The third segment was the name of the method we mapped to?
No. The last argument is a hash of options, in this particular case
you used it to set the HTTP method that should be used.
Fred