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