Sha256: 4263f2bd3fd68d68b712bfa40ef45b508516d63ec6da327a6cadd5ac332d2052

Contents?: true

Size: 543 Bytes

Versions: 2

Compression:

Stored size: 543 Bytes

Contents

class HighVoltage::PagesController < ApplicationController

  unloadable

  rescue_from ActionView::MissingTemplate do |exception|
    if exception.message =~ %r{Missing template pages/}
      raise ActionController::RoutingError, "No such page: #{params[:id]}"
    else
      raise exception
    end
  end

  def show
    render :template => current_page
  end

  protected

    def current_page
      "pages/#{clean_path}"
    end

    def clean_path
      path = Pathname.new "/#{params[:id]}"
      path.cleanpath.to_s[1..-1]
    end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
high_voltage-1.0.1 app/controllers/high_voltage/pages_controller.rb
high_voltage-1.0.0 app/controllers/high_voltage/pages_controller.rb