I have a Team class that inherits from a Group class. Both Team and
Groups have memberships through the same association. However, I need
to run a method after a Team memberships is added but not a Group. I
currently have something like this:
class Group < ActiveRecord::Base
has_many :memberships,
:class_name => 'Connection',
:foreign_key => 'connectable_id',
:as => :connectable,
:dependent => :destroy
end
class Team < Group
has_many :memberships,
:class_name => 'Connection',
:foreign_key => 'connectable_id',
:as => :connectable,
:dependent => :destroy,
:after_add => :add_company_membership
private
def membership_check(membership)
end
end
Is there some way to modify the inherited association in Team so that
I don't have to redefine the entire thing but rather just add
the :after_add hook it?
Any help would be appreciated.
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.