Ar Chron wrote:
> Just one entry in routes.rb for rushing_offenses
>
> map.resources :rushing_offenses, :collection => {:destroyall => :delete}
>
> (the :collection or :member are additions to the standard resource
> mappings, you don't need to specify a second line)
>
> and tweak the link definition
>
> <%= link_to "Destroy All", destroyall_rushing_offenses_path, :confirm =>
> "Are you
> sure?", :method => :delete %>
>
> That should do it... For fun, run a
>
> rake routes >routes.lst
>
> to get a file where you can view what all your routes look like.
PERFECT! It works now.
So, just to update..
I had two routes for map.resources (that was probably problem number 1)
The link had to be exactly as you specified above (that was problem
number 2)
Restarted my server and everything is working as intended.
So, now that I have this issue fixed, let me make sure I really
understand what I just did (or else I'm not going to learn much here)
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?
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?
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.
thanks everyone - I'm learning a lot (even from this small piece)
--
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
-~----------~----~----~----~------~----~------~--~---