search for: append_habtm_callbacks

Displaying 1 result from an estimated 1 matches for "append_habtm_callbacks".

2006 Jan 13
1
association callbacks
...pdate and before_destroy What I''m curious about is the habtm relationships. I wanted to keep track of when this changes as well. An example would be changing a user''s role. So I did this: def self.included(base) ... base.before_validation{|model| model.class.append_habtm_callbacks if model.has_backup_table? } ... end module ClassMethods def append_habtm_callbacks reflect_on_all_associations.each{ |association| if association.macro == :has_and_belongs_to_many #add_callback add_callback = "before_add_for_#{assoc...