Added a test for trac ticket 4471, and fixed the issue.
[rails.git] / app / models / relation.rb
index e5ea85d6d02788eadec62b9768e6c19120b04854..ce19f7b98ca0ffc6805dc3a680d4cf7629f9d000 100644 (file)
@@ -77,6 +77,12 @@ class Relation < ActiveRecord::Base
       relation.add_tag_keyval(tag['k'], tag['v'])
     end
 
       relation.add_tag_keyval(tag['k'], tag['v'])
     end
 
+    # need to initialise the relation members array explicitly, as if this
+    # isn't done for a new relation then @members attribute will be nil, 
+    # and the members will be loaded from the database instead of being 
+    # empty, as intended.
+    relation.members = Array.new
+
     pt.find('member').each do |member|
       #member_type = 
       logger.debug "each member"
     pt.find('member').each do |member|
       #member_type = 
       logger.debug "each member"