blob: c86f313bf012abe56b835dc52872537c2c8e14aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
class PagesController < ApplicationController
class PageNotFound < Exception; end
layout :choose_layout
rescue_from ActionView::MissingTemplate, :with => :render_404
rescue_from PageNotFound, :with => :render_404
def show
@page = StaticPage.find(params[:page])
if @page
render_page(@page)
else
raise PageNotFound.new
end
end
protected
def choose_layout
if @page && @page.props.layout
@page.props.layout
else
'application'
end
end
end
|