]> source.dussan.org Git - redmine.git/commitdiff
Moved IssueRelations to IssueRelation::Relations.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 10 Dec 2012 21:59:01 +0000 (21:59 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 10 Dec 2012 21:59:01 +0000 (21:59 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10979 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue.rb
app/models/issue_relation.rb

index c62592e26f6ddab59eb5684f49b0542ea9841b61..7f2996fd6ce29e7da51d515237750d346b043c33 100644 (file)
@@ -786,7 +786,7 @@ class Issue < ActiveRecord::Base
   end
 
   def relations
-    @relations ||= IssueRelations.new(self, (relations_from + relations_to).sort)
+    @relations ||= IssueRelation::Relations.new(self, (relations_from + relations_to).sort)
   end
 
   # Preloads relations for a collection of issues
@@ -823,7 +823,7 @@ class Issue < ActiveRecord::Base
           relations_from.select {|relation| relation.issue_from_id == issue.id} +
           relations_to.select {|relation| relation.issue_to_id == issue.id}
 
-        issue.instance_variable_set "@relations", IssueRelations.new(issue, relations.sort)
+        issue.instance_variable_set "@relations", IssueRelation::Relations.new(issue, relations.sort)
       end
     end
   end
index 140424d00ee8be2ddd4f2ea32205d5b445918ce7..8af56aedbe8e51bb821144dd26d69eec6fc9919b 100644 (file)
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
-# Class used to represent the relations of an issue
-class IssueRelations < Array
-  include Redmine::I18n
-
-  def initialize(issue, *args)
-    @issue = issue
-    super(*args)
-  end
-
-  def to_s(*args)
-    map {|relation| "#{l(relation.label_for(@issue))} ##{relation.other_issue(@issue).id}"}.join(', ')
+class IssueRelation < ActiveRecord::Base
+  # Class used to represent the relations of an issue
+  class Relations < Array
+    include Redmine::I18n
+  
+    def initialize(issue, *args)
+      @issue = issue
+      super(*args)
+    end
+  
+    def to_s(*args)
+      map {|relation| "#{l(relation.label_for(@issue))} ##{relation.other_issue(@issue).id}"}.join(', ')
+    end
   end
-end
 
-class IssueRelation < ActiveRecord::Base
   belongs_to :issue_from, :class_name => 'Issue', :foreign_key => 'issue_from_id'
   belongs_to :issue_to, :class_name => 'Issue', :foreign_key => 'issue_to_id'