Moved IssueRelations to IssueRelation::Relations.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10979 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-12-10 21:59:01 +00:00
parent 42b6f8365a
commit 228414f777
2 changed files with 16 additions and 16 deletions

View File

@ -786,7 +786,7 @@ class Issue < ActiveRecord::Base
end end
def relations def relations
@relations ||= IssueRelations.new(self, (relations_from + relations_to).sort) @relations ||= IssueRelation::Relations.new(self, (relations_from + relations_to).sort)
end end
# Preloads relations for a collection of issues # 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_from.select {|relation| relation.issue_from_id == issue.id} +
relations_to.select {|relation| relation.issue_to_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 end
end end

View File

@ -15,8 +15,9 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class IssueRelation < ActiveRecord::Base
# Class used to represent the relations of an issue # Class used to represent the relations of an issue
class IssueRelations < Array class Relations < Array
include Redmine::I18n include Redmine::I18n
def initialize(issue, *args) def initialize(issue, *args)
@ -29,7 +30,6 @@ class IssueRelations < Array
end end
end end
class IssueRelation < ActiveRecord::Base
belongs_to :issue_from, :class_name => 'Issue', :foreign_key => 'issue_from_id' belongs_to :issue_from, :class_name => 'Issue', :foreign_key => 'issue_from_id'
belongs_to :issue_to, :class_name => 'Issue', :foreign_key => 'issue_to_id' belongs_to :issue_to, :class_name => 'Issue', :foreign_key => 'issue_to_id'