Module: Refinery::Pages::InstanceMethods

Defined in:
pages/lib/refinery/pages/instance_methods.rb

Instance Method Summary collapse

Instance Method Details

#error_404(exception = nil) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'pages/lib/refinery/pages/instance_methods.rb', line 7

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

#render(*args) ⇒ Object


21
22
23
24
# File 'pages/lib/refinery/pages/instance_methods.rb', line 21

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