Sha256: d02a99d147a972a32d4a657f5b3377ecacaf1f305c858fffba3899611c311e97
Contents?: true
Size: 808 Bytes
Versions: 1
Compression:
Stored size: 808 Bytes
Contents
class HighVoltage::PagesController < ApplicationController VALID_CHARACTERS = "a-zA-Z0-9~!@$%^&*()#`_+-=<>\"{}|[];',?".freeze unloadable layout Proc.new { |_| HighVoltage.layout } rescue_from ActionView::MissingTemplate do |exception| if exception.message =~ %r{Missing template #{content_path}} raise ActionController::RoutingError, "No such page: #{params[:id]}" else raise exception end end def show render :template => current_page end protected def current_page "#{content_path}#{clean_path}" end def clean_path path = Pathname.new("/#{clean_id}") path.cleanpath.to_s[1..-1] end def content_path HighVoltage.content_path end def clean_id params[:id].tr("^#{VALID_CHARACTERS}", '') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
high_voltage-1.2.0 | app/controllers/high_voltage/pages_controller.rb |