Simplify URL scheme name matching in OAuth callback URLs a little
[rails.git] / app / models / relation_member.rb
1 class RelationMember < ActiveRecord::Base
2   set_table_name 'current_relation_members'
3   
4   set_primary_keys :id, :sequence_id
5   belongs_to :member, :polymorphic => true
6   belongs_to :relation, :foreign_key => :id
7
8   def after_find
9     self[:member_class] = self.member_type.classify
10   end
11
12   def after_initialize
13     self[:member_class] = self.member_type.classify unless self.member_type.nil?
14   end
15
16   def before_save
17     self.member_type = self[:member_class].classify
18   end
19
20   def member_type=(type)
21     self[:member_type] = type
22     self[:member_class] = type.capitalize
23   end
24 end