Sha256: 6a727e46a7220e62e2b31079e9e3e996cbb60dccbab7c69e505a30fce4268dda
Contents?: true
Size: 1.11 KB
Versions: 4
Compression:
Stored size: 1.11 KB
Contents
Spree::BaseController.class_eval do # ProductsHelper needed for seo_url method used when generating # taxonomies partial in content/show.html.erb. helper :products # Use before_filter instead of prepend_before_filter to ensure that # ApplicationController filters that the view may require are run. before_filter :render_page_if_exists # Checks if page is not beeing overriden by static one that starts with / # # Using request.path allows us to override dynamic pages including # the home page, product and taxon pages. def render_page_if_exists # If we don't know if page exists we assume it's and we query DB. # But we realy don't want to query DB on each page we're sure doesn't exist! return if Rails.cache.fetch('page_not_exist/'+request.path) if @page = Page.visible.find_by_slug(request.path) if @page.layout && !@page.layout.empty? render :template => 'static_content/show', :layout => @page.layout else render :template => 'static_content/show' end else Rails.cache.write('page_not_exist/'+request.path, true) return(nil) end end end
Version data entries
4 entries across 4 versions & 1 rubygems