Skip to content

Commit

Permalink
Rails3: model: replace deprecated 'before_destroy' method at WikiPage…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
marutosi committed Sep 22, 2011
1 parent 2d541a7 commit ec1b9f3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/wiki_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down Expand Up @@ -86,7 +87,7 @@ def before_save
end
end

def before_destroy
def remove_redirects
# Remove redirects to this page
wiki.redirects.find_all_by_redirects_to(title).each(&:destroy)
end
Expand Down

0 comments on commit ec1b9f3

Please sign in to comment.