Module: RackStep::Controller::HtmlRendering
- Defined in:
- lib/controller.rb
Overview
A module for controllers to add static html pages rendering. This is not the best way to serve static content. In production, consider using Nginx or Apache. Using ruby/rack to serve static content is a waste of resources and should be only used for low traffic web pages. This method is provided so that in this circumstances you may use it to keep a simpler architecture.
Instance Method Summary collapse
Instance Method Details
#render_page(page_name, pages_directory = 'app/public/pages') ⇒ Object
64 65 66 |
# File 'lib/controller.rb', line 64 def render_page(page_name, pages_directory = 'app/public/pages') File.read("#{pages_directory}/#{page_name}.html") end |