@@ -43,6 +43,7 class WikiPage < ActiveRecord::Base | |||
|
43 | 43 | validates_associated :content |
|
44 | 44 | |
|
45 | 45 | validate :validate_parent_title |
|
46 | before_destroy :remove_redirects | |
|
46 | 47 | |
|
47 | 48 | # eager load information about last updates, without loading text |
|
48 | 49 | named_scope :with_updated_on, { |
@@ -86,7 +87,7 class WikiPage < ActiveRecord::Base | |||
|
86 | 87 | end |
|
87 | 88 | end |
|
88 | 89 | |
|
89 | def before_destroy | |
|
90 | def remove_redirects | |
|
90 | 91 | # Remove redirects to this page |
|
91 | 92 | wiki.redirects.find_all_by_redirects_to(title).each(&:destroy) |
|
92 | 93 | end |
General Comments 0
You need to be logged in to leave comments.
Login now