]> source.dussan.org Git - redmine.git/commitdiff
Rails3: model: replace deprecated 'before_save' method at WikiPage model
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 22 Sep 2011 00:54:37 +0000 (00:54 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 22 Sep 2011 00:54:37 +0000 (00:54 +0000)
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

app/models/wiki_page.rb

index 2fe2be53f4775a0bbd98fdb4aa8ca4904c8e47a6..27ab4f570b221a796e175f89f28041e59bb25964 100644 (file)
@@ -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?