Skip to content

Commit

Permalink
Don't cache when there's no pages
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt committed Jun 22, 2010
1 parent aefb7c7 commit 26b92c1
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -61,8 +61,10 @@ def login?

# get all the pages to be displayed in the site menu.
def find_pages_for_menu
@menu_pages = Rails.cache.read(cache_key = "#{Refinery.base_cache_key}_menu_pages")
@menu_pages = Rails.cache.write(cache_key, Page.top_level(include_children=true)) if @menu_pages.nil?
if (@menu_pages = Rails.cache.read(cache_key = "#{Refinery.base_cache_key}_menu_pages")).nil?
@menu_pages = Page.top_level(include_children = true)
Rails.cache.write(cache_key, @menu_pages) if @menu_pages.present?
end
end

# use a different model for the meta information.
Expand Down

0 comments on commit 26b92c1

Please sign in to comment.