Class: StaticStuff::PagesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- StaticStuff::PagesController
- Defined in:
- app/controllers/static_stuff/pages_controller.rb
Instance Method Summary collapse
Instance Method Details
#layout(layout = nil) ⇒ Object
3 4 5 6 7 |
# File 'app/controllers/static_stuff/pages_controller.rb', line 3 def layout layout = nil @layout = layout unless layout.nil? return 'application' if @layout.nil? @layout end |
#show ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/static_stuff/pages_controller.rb', line 11 def show template = File.join( File.basename(params[:controller]), params[:page] ) html = render_to_string template, layout: false render text: html, layout: layout rescue ActionView::MissingTemplate => error if error. =~ %r{Missing template #{template}} = "Static page not found. No route matches [GET] /#{template}" raise ActionController::RoutingError, else raise error end end |