#800 ✓not-applicable
zhhz

parent.children.destroy! bypass the child's before :destry hook

Reported by zhhz | February 11th, 2009 @ 10:39 AM

I am not sure if this is the feature, it is designed to do so, or I'm doing it wrong. Here is situation I have:

version: 0.9.9

class Order before :destry, :destroy_items .... has n, items

def destroy_items

  # this by pass the items before destroy
  items.destroy!

  # this part is working, the :check_xxx is called
  items.each |item| do
     ...
     item.destroy
   end

end end

class OrderLineItem ... before :destroy, :check_xxx

belongs_to :order

def check_xxx

 raise "the_error_message" if xxxxx

end

end

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Tags

Pages