Efficiency

Introduce page.rev_ids, and use
that, wherever possible, instead
of page.revisions.

This avoids fetching the text of
all the revisions. D'oh!
This commit is contained in:
Jacques Distler 2011-04-25 10:54:44 -05:00
parent c010e6b7a4
commit 7290e90631
8 changed files with 27 additions and 25 deletions

View file

@ -55,7 +55,7 @@ require 'instiki_stringsupport'
# Create a hyperlink to a particular revision of a Wiki page
def link_to_revision(page, revision_number, text = nil, mode = nil, html_options = {})
revision_number == page.revisions.size ?
revision_number == page.rev_ids.size ?
link_to(
text || page.plain_name,
{:web => @web.address, :action => 'show', :id => page.name,
@ -109,7 +109,7 @@ require 'instiki_stringsupport'
end
def rendered_content(page)
PageRenderer.new(page.revisions.last).display_content
PageRenderer.new(page.current_revision).display_content
end
def truncate(text, *args)