1 class RelationMember < ActiveRecord::Base
2 set_table_name 'current_relation_members'
3 set_primary_keys :relation_id, :sequence_id
6 belongs_to :member, :polymorphic => true
8 after_find :set_class_from_type
9 after_initialize :set_class_from_type
10 before_save :set_type_from_class
12 def member_type=(type)
13 self[:member_type] = type
14 self[:member_class] = type.capitalize
19 def set_class_from_type
20 self[:member_class] = self.member_type.classify unless self.member_type.nil?
23 def set_type_from_class
24 self.member_type = self[:member_class].classify