If I have a model that has_many of another table, how can I make it so that when i call that model's destroy method that it also destroys all the children? Is there a method to do this?
Currently I do it like this:
It works but I was wondering if maybe there was a better way :)Code:
Item.destroy_all 'shop_id = ' + @params[:id]