module Semistatic::Concerns::Controllers::PageViewController

Public Instance Methods

show() click to toggle source

get the page by slug show action render “layouts/templates/#{@page.template_name}” @raises ActiveRecord::RecordNotFound when page is not found

# File lib/semistatic/concerns/controllers/page_view_controller.rb, line 15
def show
  page = Page.find_by_slug(params[:slug])

  unless page
    raise ActiveRecord::RecordNotFound.new("Page not found")
  end

  @presenter = Presenters::PagePresenter.new(page, self.class.helpers)

  render file: "semistatic/#{page.template_name}", layout: page.layout
end