From: Jean-Philippe Lang Date: Mon, 4 Jul 2011 17:31:06 +0000 (+0000) Subject: Document why relation is reversed after validation. X-Git-Tag: 1.3.0~1738 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=79f25c08f8ce46ea19c1b172ffa0a56fab3c92f7;p=redmine.git Document why relation is reversed after validation. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6178 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/issue_relation.rb b/app/models/issue_relation.rb index c66103c51..5b050c9a3 100644 --- a/app/models/issue_relation.rb +++ b/app/models/issue_relation.rb @@ -115,6 +115,8 @@ class IssueRelation < ActiveRecord::Base private # Reverses the relation if needed so that it gets stored in the proper way + # Should not be reversed before validation so that it can be displayed back + # as entered on new relation form def reverse_if_needed if TYPES.has_key?(relation_type) && TYPES[relation_type][:reverse] issue_tmp = issue_to diff --git a/test/unit/issue_relation_test.rb b/test/unit/issue_relation_test.rb index 3c8347b45..fa0594496 100644 --- a/test/unit/issue_relation_test.rb +++ b/test/unit/issue_relation_test.rb @@ -50,9 +50,6 @@ class IssueRelationTest < ActiveSupport::TestCase assert_equal from, relation.issue_to end - # TODO : document why it shouldn't be reversed if validation fails : having - # relations reversed before the validation would allow simpler code for the - # validation def test_follows_relation_should_not_be_reversed_if_validation_fails from = Issue.find(1) to = Issue.find(2)