diff options
author | elijah <elijah@riseup.net> | 2012-08-24 21:12:36 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2012-08-24 21:12:36 -0700 |
commit | 627f0488e5bd3c31359fc9e78acffbfea4a86a8b (patch) | |
tree | f7b14733e314cf82d5fa3e18cbe9d98c2ffe5c7c /app/controllers/pages_controller.rb | |
parent | b774dea07f97b078fa17e5dcbf901d1c83fed0d6 (diff) |
committed website v. 0.1.0
Diffstat (limited to 'app/controllers/pages_controller.rb')
-rw-r--r-- | app/controllers/pages_controller.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb new file mode 100644 index 0000000..c86f313 --- /dev/null +++ b/app/controllers/pages_controller.rb @@ -0,0 +1,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 + |