Created
February 11, 2009 16:37
-
-
Save zhhz/62107 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#I am not sure if this is the feature(it is designed to do so), | |
# or I'm doing it wrong. Here is the situation I have: | |
# as of DM version: 0.9.9 | |
class Order | |
before :destroy, :destroy_items | |
.... | |
has n, items ... | |
def destroy_items | |
# NOT working | |
# this by pass the item's before destroy hook | |
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment