Class: PagesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/pages_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/pages_controller.rb', line 2

def show
  if current_page.nil?
    flash[:error] = "No root page! Make sure to add a page first"
    redirect_to cardboard.dashboard_path
  else
    if current_page.using_slug_backup?
      redirect_to current_page.url, status: :moved_permanently
    else
      # call controller hook
      self.send(current_page.identifier) if self.respond_to? current_page.identifier

      render "cardboard/pages/show", layout: @layout || "layouts/application"
    end
  end
end