summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-04 17:31:06 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-04 17:31:06 +0000
commit79f25c08f8ce46ea19c1b172ffa0a56fab3c92f7 (patch)
treea023e0313cd8a8e39fd818b7b27747d9a3e39231
parentea06b3cca5070dc5033de13e79e2dcf6f4cce2c1 (diff)
downloadredmine-79f25c08f8ce46ea19c1b172ffa0a56fab3c92f7.tar.gz
redmine-79f25c08f8ce46ea19c1b172ffa0a56fab3c92f7.zip
Document why relation is reversed after validation.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6178 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/issue_relation.rb2
-rw-r--r--test/unit/issue_relation_test.rb3
2 files changed, 2 insertions, 3 deletions
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)