Class: PagesController

Inherits:
SlicesController show all
Defined in:
app/controllers/pages_controller.rb

Instance Method Summary collapse

Methods inherited from SlicesController

should_raise_exceptions?

Instance Method Details

#createObject

Raises:



14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/pages_controller.rb', line 14

def create
  page = Page.find_by_path(request.path)
  raise Page::NotFound unless page.active?
  slice = post_slice(page)
  if slice.handle_post(params)
    slice.set_success_message(flash)
    redirect_to(slice.redirect_url)
  else
    render_page(page)
  end
end

#showObject



26
27
28
29
30
31
32
33
# File 'app/controllers/pages_controller.rb', line 26

def show
  page = nil
  benchmark 'Page.find_by_path' do
    page = Page.find_by_path(request.path)
    raise Page::NotFound unless page.active?
  end
  render_page(page)
end

#virtual_error_pagesObject



5
6
7
8
9
10
11
12
# File 'app/controllers/pages_controller.rb', line 5

def virtual_error_pages
  role = Page.role_for_status(params[:status])
  if role
    render_page(Page.find_virtual(role), 200)  # page is only cached if status is 200
  else
    raise Page::NotFound.new(request.path)
  end
end