diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-09-22 00:53:53 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-09-22 00:53:53 +0000 |
commit | ec1b9f38f3d2dfbeb909b6b83e9815d5b7ad3d8e (patch) | |
tree | e84e5686a7001e57c5966a37d094b7e24a16a93e /app/models/wiki_page.rb | |
parent | 2d541a7e1b233cb050480e4ac81fc7363157b6c3 (diff) | |
download | redmine-ec1b9f38f3d2dfbeb909b6b83e9815d5b7ad3d8e.tar.gz redmine-ec1b9f38f3d2dfbeb909b6b83e9815d5b7ad3d8e.zip |
Rails3: model: replace deprecated 'before_destroy' method at WikiPage model
test_redirects_removed_when_deleting_page at unit wiki_redirect_test.rb has this test.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7437 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/wiki_page.rb')
-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 4c2c7adb9..2fe2be53f 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -43,6 +43,7 @@ class WikiPage < ActiveRecord::Base validates_associated :content validate :validate_parent_title + before_destroy :remove_redirects # eager load information about last updates, without loading text named_scope :with_updated_on, { @@ -86,7 +87,7 @@ class WikiPage < ActiveRecord::Base end end - def before_destroy + def remove_redirects # Remove redirects to this page wiki.redirects.find_all_by_redirects_to(title).each(&:destroy) end |