module RackStep::Controller::ErbRendering

A module for controllers to add ERB template rendering. RackStep is not meant to be used for template rendering. We recommend you to use a SPA (Single Page Application) approach. But if you want to, you may include this module into your controller and render ERB templates, following the old ruby web way. TODO: Add layout support.

Public Instance Methods

render_erb(template_name, erb_template_directory = 'app/public/pages') click to toggle source
# File lib/controller.rb, line 68
def render_erb(template_name, erb_template_directory = 'app/public/pages')
  template_path = "#{erb_template_directory}/#{template_name}.erb"
  erb = ERB.new(File.open(template_path).read)
  return erb.result(binding)
end