]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/relation.rb
Make the polymorphic relation association work properly.
[rails.git] / app / models / relation.rb
index cd2d67cdde0b969020d88530fdc82748f6f19451..71ddc4a554f0e696b83187d1df5014bade7946c3 100644 (file)
@@ -10,8 +10,8 @@ class Relation < ActiveRecord::Base
   has_many :relation_members, :foreign_key => 'id'
   has_many :relation_tags, :foreign_key => 'id'
 
-  has_many :containing_relation_members, :as => :member
-  has_many :containing_relations, :through => :containing_relation_members
+  has_many :containing_relation_members, :class_name => "RelationMember", :as => :member
+  has_many :containing_relations, :class_name => "Relation", :through => :containing_relation_members, :source => :relation
 
   def self.from_xml(xml, create=false)
     begin