##// END OF EJS Templates
Document why relation is reversed after validation....
Jean-Philippe Lang -
r6058:79f25c08f8ce
parent child
Show More
@@ -115,6 +115,8 class IssueRelation < ActiveRecord::Base
115 private
115 private
116
116
117 # Reverses the relation if needed so that it gets stored in the proper way
117 # Reverses the relation if needed so that it gets stored in the proper way
118 # Should not be reversed before validation so that it can be displayed back
119 # as entered on new relation form
118 def reverse_if_needed
120 def reverse_if_needed
119 if TYPES.has_key?(relation_type) && TYPES[relation_type][:reverse]
121 if TYPES.has_key?(relation_type) && TYPES[relation_type][:reverse]
120 issue_tmp = issue_to
122 issue_tmp = issue_to
@@ -50,9 +50,6 class IssueRelationTest < ActiveSupport::TestCase
50 assert_equal from, relation.issue_to
50 assert_equal from, relation.issue_to
51 end
51 end
52
52
53 # TODO : document why it shouldn't be reversed if validation fails : having
54 # relations reversed before the validation would allow simpler code for the
55 # validation
56 def test_follows_relation_should_not_be_reversed_if_validation_fails
53 def test_follows_relation_should_not_be_reversed_if_validation_fails
57 from = Issue.find(1)
54 from = Issue.find(1)
58 to = Issue.find(2)
55 to = Issue.find(2)
General Comments 0
You need to be logged in to leave comments. Login now