Class: Effective::PagesController

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

Instance Method Summary collapse

Instance Method Details

#showObject

Raises:

  • (ActiveRecord::RecordNotFound)


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

def show
  @pages = (Rails::VERSION::MAJOR > 3 ? Effective::Page.all : Effective::Page.scoped)
  @pages = @pages.published if params[:edit].to_s != 'true'

  @page = @pages.find(params[:id])

  raise ActiveRecord::RecordNotFound unless @page.present? # Incase .find() isn't raising it
  raise Effective::AccessDenied unless @page.roles_permit?(current_user)

  EffectivePages.authorized?(self, :show, @page)

  @page_title = @page.title

  render @page.template, :layout => @page.layout, :locals => {:page => @page}
end