Hello again,
What is the best way to delete all children of a parent in a controller.
For example I have restaurants with a has_many association to
boundaries. I would like to do something like this:
@restaurant.boundaries.delete_all
is it possible?
steve
On Thu, Mar 27, 2008 at 04:59:45PM +0100, Steve G. wrote:
What is the best way to delete all children of a parent in a controller.
For example I have restaurants with a has_many association to
boundaries. I would like to do something like this:
@restaurant.boundaries.delete_all
is it possible?
Look at collection.clear under
http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html#M001103
steve
–Greg