Rails3: model: replace deprecated 'before_save' method at IssueRelation model

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7426 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-09-21 04:50:07 +00:00
parent 5c46cede2b
commit 3268a190ae
1 changed files with 3 additions and 1 deletions

View File

@ -45,6 +45,8 @@ class IssueRelation < ActiveRecord::Base
attr_protected :issue_from_id, :issue_to_id
before_save :handle_issue_order
def visible?(user=User.current)
(issue_from.nil? || issue_from.visible?(user)) && (issue_to.nil? || issue_to.visible?(user))
end
@ -96,7 +98,7 @@ class IssueRelation < ActiveRecord::Base
TYPES[relation_type] ? TYPES[relation_type][(self.issue_from_id == issue.id) ? :name : :sym_name] : :unknow
end
def before_save
def handle_issue_order
reverse_if_needed
if TYPE_PRECEDES == relation_type