Sha256: 2019afe7c1baa8e1a8b4969f532a6ae3120c8f98e4e107a1bba7d3dd6bfe334a

Contents?: true

Size: 616 Bytes

Versions: 2

Compression:

Stored size: 616 Bytes

Contents

class HighVoltage::PagesController < ApplicationController
  unloadable
  layout Proc.new { |_| HighVoltage.layout }

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

  def show
    render :template => current_page
  end

  private

  def current_page
    page_finder.find
  end

  def page_finder
    page_finder_factory.new(params[:id])
  end

  def page_finder_factory
    HighVoltage::PageFinder
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
high_voltage-1.2.2 app/controllers/high_voltage/pages_controller.rb
high_voltage-1.2.1 app/controllers/high_voltage/pages_controller.rb