Topic: Generic Destroyer Method - How to specify a table in a link_to?

I'm designing an admin controller that should allow the user to delete many different types of data. I'd like to have a generic destroyer method that can take a classname/table name, and an :id, and delete the specified object from the specified table (so that I don't need a separate method for each class/table).

My problem is that I'm not sure how to pass the classname up through a link_to (I don't want this hardcoded in the view, because then I'd just need a new partial for every class type). Or is there a query I could make on the controller side? Or is there a better way of looking at this? Thanks for any help.

Re: Generic Destroyer Method - How to specify a table in a link_to?

it's as easy as:

link_to 'Click Here', :controller => 'admin', :action => 'delete', :object_type => 'User', :id => 5

Re: Generic Destroyer Method - How to specify a table in a link_to?

awesome! Thanks.

Last edited by bheilig (2006-12-18 17:45:47)