Sha256: 6d8612f33a3118b8e168a9af2bdb8ac85feedf399651fa6bf329fe4a6579d922

Contents?: true

Size: 669 Bytes

Versions: 1

Compression:

Stored size: 669 Bytes

Contents

class HighVoltage::PagesController < ApplicationController

  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 "/#{params[:id]}"
      path.cleanpath.to_s[1..-1]
    end

    def content_path
      HighVoltage::content_path
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
high_voltage-1.1.1 app/controllers/high_voltage/pages_controller.rb