Rails3: model: replace deprecated 'before_validation' method at Change model

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7435 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-09-21 13:56:16 +00:00
parent 8e7b0a7bac
commit 579acce9f6
1 changed files with 2 additions and 1 deletions

View File

@ -20,12 +20,13 @@ class Change < ActiveRecord::Base
validates_presence_of :changeset_id, :action, :path validates_presence_of :changeset_id, :action, :path
before_save :init_path before_save :init_path
before_validation :replace_invalid_utf8_of_path
def relative_path def relative_path
changeset.repository.relative_path(path) changeset.repository.relative_path(path)
end end
def before_validation def replace_invalid_utf8_of_path
self.path = Redmine::CodesetUtil.replace_invalid_utf8(self.path) self.path = Redmine::CodesetUtil.replace_invalid_utf8(self.path)
self.from_path = Redmine::CodesetUtil.replace_invalid_utf8(self.from_path) self.from_path = Redmine::CodesetUtil.replace_invalid_utf8(self.from_path)
end end