Sha256: b6967aeda337e8eb17abd25d6a439a836488ce2f367efd367a737c7a258c9b5b

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

module Refinery
  module Pages
    module InstanceMethods

      def error_404(exception=nil)
        if (@page = Page.where(:menu_match => "^/404$").includes(:parts, :slugs).first).present?
          # render the application's custom 404 page with layout and meta.
          render :template => "/pages/show",
                 :format => 'html',
                 :status => 404
        else
          super
        end
      end

    protected
      def find_pages_for_menu
        @menu_pages = Page.in_menu.live.order('lft ASC').includes(:slugs)
      end

      def render(*args)
        present(@page) unless admin? or @meta.present?
        super
      end

    private
      def store_current_location!
        unless admin?
          session[:website_return_to] = url_for(@page.url) if @page.try(:present?)
        else
          super
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
refinerycms-pages-0.9.9.16 lib/refinery/pages/instance_methods.rb