@@ -44,6 +44,7 class WikiPage < ActiveRecord::Base | |||
|
44 | 44 | |
|
45 | 45 | validate :validate_parent_title |
|
46 | 46 | before_destroy :remove_redirects |
|
47 | before_save :handle_redirects | |
|
47 | 48 | |
|
48 | 49 | # eager load information about last updates, without loading text |
|
49 | 50 | named_scope :with_updated_on, { |
@@ -70,7 +71,7 class WikiPage < ActiveRecord::Base | |||
|
70 | 71 | write_attribute(:title, value) |
|
71 | 72 | end |
|
72 | 73 | |
|
73 | def before_save | |
|
74 | def handle_redirects | |
|
74 | 75 | self.title = Wiki.titleize(title) |
|
75 | 76 | # Manage redirects if the title has changed |
|
76 | 77 | if !@previous_title.blank? && (@previous_title != title) && !new_record? |
General Comments 0
You need to be logged in to leave comments.
Login now