I am using PostgreSql as database and Rails 3.1.3 and ruby 1.9.3
I have 3 models.
- Activity
- ActivityObject
- ActivityObjectActivity
They are related this way.
**Activity**
> has_many :activity_object_activities,:dependent => :destroy
> has_many :activity_objects, :through => :activity_object_activities
> after_destroy :do_something_on_activity_object_related
**ActivityObject**
> has_many :activity_object_activities, :dependent => :destroy
> has_many :activities, :through => :activity_object_activities
**ActivityObjectActivity**
> belongs_to :activity, :dependent => :destroy
> belongs_to :activity_object
When I do a destroy on an activity, what I observe is , the
activity_object_activities table entry is getting deleted before the
call of "do_something_on_activity_object_related" due to
"dependent:
destroy".
So because of this, when the "do_something_on_activity_object_related"
method is called when the activity is destroyed ,it is not able to find
out the activity_object associated with the activity.
Is there a method by which I can call this
"do_something_on_activity_object_related" before the associations
related with the activity are destroyed.
Is there any way I can change the order of the after_destroy callbacks.
Thanks In Advance.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.