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:
parent
42b6f8365a
commit
228414f777
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
Loading…
Reference in New Issue