diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-10 21:59:01 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-10 21:59:01 +0000 |
commit | 228414f777a6ca7ce12ab21bf4bd7152b46c89c8 (patch) | |
tree | 3f081ece9fa99abbb3a938737cf4a257445e276a /app/models | |
parent | 42b6f8365ad42613e29d546c1bfe4bc1c682f12c (diff) | |
download | redmine-228414f777a6ca7ce12ab21bf4bd7152b46c89c8.tar.gz redmine-228414f777a6ca7ce12ab21bf4bd7152b46c89c8.zip |
Moved IssueRelations to IssueRelation::Relations.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10979 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/issue.rb | 4 | ||||
-rw-r--r-- | app/models/issue_relation.rb | 26 |
2 files changed, 15 insertions, 15 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index c62592e26..7f2996fd6 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -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 diff --git a/app/models/issue_relation.rb b/app/models/issue_relation.rb index 140424d00..8af56aedb 100644 --- a/app/models/issue_relation.rb +++ b/app/models/issue_relation.rb @@ -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(', ') +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' |