Sha256: 32a1104d57cc95b492f21396cf4cbe3345efae7377eaba5fc56ff571596e46cb
Contents?: true
Size: 807 Bytes
Versions: 5
Compression:
Stored size: 807 Bytes
Contents
module HighVoltage::StaticPage extend ActiveSupport::Concern included do layout ->(_) { HighVoltage.layout } rescue_from ActionView::MissingTemplate do |exception| if exception.message =~ %r{Missing template #{page_finder.content_path}} invalid_page else raise exception end end rescue_from HighVoltage::InvalidPageIdError, with: :invalid_page end def show render( template: current_page, locals: { current_page: current_page }, ) end def invalid_page raise ActionController::RoutingError, "No such page: #{params[:id]}" 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
5 entries across 5 versions & 1 rubygems