diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-09-22 00:54:37 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-09-22 00:54:37 +0000 |
commit | e16d20f1b47f66e72edaaa6a28d35582876bd73d (patch) | |
tree | 43c0c4cfe00acc316bad9625e64566f6f7c2c28f /app | |
parent | ec1b9f38f3d2dfbeb909b6b83e9815d5b7ad3d8e (diff) | |
download | redmine-e16d20f1b47f66e72edaaa6a28d35582876bd73d.tar.gz redmine-e16d20f1b47f66e72edaaa6a28d35582876bd73d.zip |
Rails3: model: replace deprecated 'before_save' method at WikiPage model
unit wiki_redirect_test.rb has this test.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7438 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/wiki_page.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 2fe2be53f..27ab4f570 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -44,6 +44,7 @@ class WikiPage < ActiveRecord::Base validate :validate_parent_title before_destroy :remove_redirects + before_save :handle_redirects # eager load information about last updates, without loading text named_scope :with_updated_on, { @@ -70,7 +71,7 @@ class WikiPage < ActiveRecord::Base write_attribute(:title, value) end - def before_save + def handle_redirects self.title = Wiki.titleize(title) # Manage redirects if the title has changed if !@previous_title.blank? && (@previous_title != title) && !new_record? |