Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (29 sloc) 0.808 kB
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
Jump to Line
Something went wrong with that request. Please try again.