##// END OF EJS Templates
Refactor: extract finder to a utility method...
Eric Davis -
r4138:bbbfd4ee4cf3
parent child
Show More
@@ -175,12 +175,7 class WikiController < ApplicationController
175 175 case page_title
176 176 # show pages index, sorted by title
177 177 when 'page_index', 'date_index'
178 # eager load information about last updates, without loading text
179 @pages = @wiki.pages.find :all, :select => "#{WikiPage.table_name}.*, #{WikiContent.table_name}.updated_on",
180 :joins => "LEFT JOIN #{WikiContent.table_name} ON #{WikiContent.table_name}.page_id = #{WikiPage.table_name}.id",
181 :order => 'title'
182 @pages_by_date = @pages.group_by {|p| p.updated_on.to_date}
183 @pages_by_parent_id = @pages.group_by(&:parent_id)
178 load_pages_grouped_by_date_without_content
184 179 when 'export'
185 180 redirect_to :action => 'export', :id => @project # Compatibility stub while refactoring
186 181 return
@@ -249,4 +244,14 private
249 244 extend helper unless self.instance_of?(helper)
250 245 helper.instance_method(:initial_page_content).bind(self).call(page)
251 246 end
247
248 # eager load information about last updates, without loading text
249 def load_pages_grouped_by_date_without_content
250 @pages = @wiki.pages.find :all, :select => "#{WikiPage.table_name}.*, #{WikiContent.table_name}.updated_on",
251 :joins => "LEFT JOIN #{WikiContent.table_name} ON #{WikiContent.table_name}.page_id = #{WikiPage.table_name}.id",
252 :order => 'title'
253 @pages_by_date = @pages.group_by {|p| p.updated_on.to_date}
254 @pages_by_parent_id = @pages.group_by(&:parent_id)
255 end
256
252 257 end
General Comments 0
You need to be logged in to leave comments. Login now