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
This commit is contained in:
parent
ec1b9f38f3
commit
e16d20f1b4
|
@ -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?
|
||||
|
|
Loading…
Reference in New Issue