2009/6/8 J. D. <[email protected]>:
>
> Colin Law wrote:
>> 2009/6/8 J. D. <[email protected]>:
>>> <%= link_to 'Destroy All', @rushing_offenses.all.destroy!, :confirm =>
>>>      format.xml  { head :ok }
>>>    end
>>>  end
>>>
>>> I simply want to place a link on one of my pages that when clicked, it
>>> destroys all of the data inside the table (but not the table or model
>>> itself) and then redirects back to the main page which is
>>> @rushing_offenses.
>>>
>>
>> Are you sure that is a good idea?  What will happen when google
>> follows the link?  It might be better as a post rather then a get.
>>
>> Colin
>
> Hi Colin,
>
> I'm just going to be using it for my development platform.  I simply
> want a link so that I can quickly remove all data in a particular table
> and then be able to re-populate it with some new data..
>
> Can you provide me with a way to do that?
>

Actually I was talking rubbish, the :method => :delete will make it a post.
I think you want something like
<%= link_to 'Destroy All', :action => 'destroyall', :confirm => 'Are
you sure?', :method => :delete %>
but you might need something in routes as well, I am not sure.

Colin


> --
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to