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
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

View File

@ -15,21 +15,21 @@
# 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(', ')
end
end
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
belongs_to :issue_from, :class_name => 'Issue', :foreign_key => 'issue_from_id'
belongs_to :issue_to, :class_name => 'Issue', :foreign_key => 'issue_to_id'