On Tue, Jun 9, 2009 at 10:29 AM, Älphä
Blüë<[email protected]> wrote:
>
> Rick Denatale wrote:
>> I think you want
>>
>> map.resources :rushing_offenses, :collection => {:delete =>
>> :destroyall}
>
> Thanks Rick.
>
> When I do this I get the following error:
>
> Invalid HTTP method specified in route conditions: {:method=>
> :destroyall} (Argument Error)
>
Oops, that was a brain fart on my part, yes the order should be
:destroyall => :delete
>
> My index.html.erb file under views\rushing_offenses looks like:
>
> <h1>Rushing Offense</h1>
> <h5>Current Time is <%= Time.now.to_s(:long) %> </h5>
...
> <%= link_to 'Destroy All', :action => 'destroyall', :confirm => 'Are you
> sure?', :method => :delete %>
Maybe
<%= link_to "Destroy All", rushing_offenses_path(:method =>
:delete), :confirm> "Are you sure?" %>
>From your earlier post, it looks like you were ending up with a url of
rushing_offense/destroyall?method=delete&confirm=Are+you+sure%3F and a
get request which ends up getting routed to the show action.
--
Rick DeNatale
Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---