2009/6/8 J. D. <[email protected]>: > > I've been looking around and can't seem to find something that shows how > to do this.. > > My controller is rushing_offenses_controller.rb > My model is rushing_offense.rb > > I'd like to use something similar but I'm not all that familiar with > REST. > > <%= link_to 'Destroy All', @rushing_offenses.all.destroy!, :confirm => > 'Are you sure?', :method => :delete %> > > I have a method in my controller called destroyall which does: > > def destroyall > �...@rushing_offense = RushingOffense.find(:all) > �...@rushing_offense.destroy > > respond_to do |format| > format.html { redirect_to(rushing_offenses_url) } > 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 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

