Skip to content

Commit

Permalink
Include contents (to speed things up a bit)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Glen committed May 9, 2014
1 parent 65bb5d7 commit 58f5890
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/controllers/smithy/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ def initialize_page
end

def load_page
@page = Page.find(params[:id])
@page = Page.includes(:contents).find(params[:id])
@root = @page if Page.root == @page
set_publish
end

def load_page_from_path
if smithy_current_user
@page = Page.friendly.find(page_path)
@page = Page.includes(:contents).friendly.find(page_path)
else
@page = Page.published.friendly.find(page_path)
@page = Page.includes(:contents).published.friendly.find(page_path)
end
redirect_to @page.external_link and return false if @page.external_link?
end
Expand Down
6 changes: 3 additions & 3 deletions lib/smithy/liquid/rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ module Rendering

def render_smithy_page
if smithy_current_user
output = @page.template.liquid_template.render(liquid_context)
output = @page.render(liquid_context)
else
output = Rails.cache.fetch("#{@page.cache_key}-render_smithy_page") do
@page.template.liquid_template.render(liquid_context)
@page.render(liquid_context)
end
end
render :text => output, :layout => false
Expand All @@ -21,7 +21,7 @@ def render_as_smithy_page(template_name)
end

def liquid_context
::Liquid::Context.new({}, smithy_default_assigns, smithy_default_registers, false)
::Liquid::Context.new({}, smithy_default_assigns, smithy_default_registers, !Rails.env.production?)
end

def smithy_default_assigns
Expand Down

0 comments on commit 58f5890

Please sign in to comment.