]> git.openstreetmap.org Git - rails.git/blob - app/models/relation_member.rb
update nodes/ways/relation XML to include user id as well as display name
[rails.git] / app / models / relation_member.rb
1 class RelationMember < ActiveRecord::Base
2   set_table_name 'current_relation_members'
3   
4   belongs_to :member, :polymorphic => true, :foreign_type => :member_class
5   belongs_to :relation, :foreign_key => :id
6
7   def after_find
8     self[:member_class] = self.member_type.capitalize
9   end
10
11   def after_initialize
12     self[:member_class] = self.member_type.capitalize
13   end
14
15   def before_save
16     self.member_type = self[:member_class].downcase
17   end
18
19   def member_type=(type)
20     self[:member_type] = type
21     self[:member_class] = type.capitalize
22   end
23 end