##// END OF EJS Templates
Rails4: replace deprecated find_all_by_* at WikiPage model...
Toshi MARUYAMA -
r12258:95d86daef3aa
parent child
Show More
@@ -82,7 +82,7 class WikiPage < ActiveRecord::Base
82 # Manage redirects if the title has changed
82 # Manage redirects if the title has changed
83 if !@previous_title.blank? && (@previous_title != title) && !new_record?
83 if !@previous_title.blank? && (@previous_title != title) && !new_record?
84 # Update redirects that point to the old title
84 # Update redirects that point to the old title
85 wiki.redirects.find_all_by_redirects_to(@previous_title).each do |r|
85 wiki.redirects.where(:redirects_to => @previous_title).each do |r|
86 r.redirects_to = title
86 r.redirects_to = title
87 r.title == r.redirects_to ? r.destroy : r.save
87 r.title == r.redirects_to ? r.destroy : r.save
88 end
88 end
@@ -96,7 +96,7 class WikiPage < ActiveRecord::Base
96
96
97 def remove_redirects
97 def remove_redirects
98 # Remove redirects to this page
98 # Remove redirects to this page
99 wiki.redirects.find_all_by_redirects_to(title).each(&:destroy)
99 wiki.redirects.where(:redirects_to => title).each(&:destroy)
100 end
100 end
101
101
102 def pretty_title
102 def pretty_title
General Comments 0
You need to be logged in to leave comments. Login now