Sha256: 8edffbe9d77c8eb0ce255302208a84bdac06599493626b3f63f3d929b4c3e360
Contents?: true
Size: 554 Bytes
Versions: 1
Compression:
Stored size: 554 Bytes
Contents
module HighVoltage module Constraints # Routing constraint to validate request.path has a corresponding view class RootRoute VIEW_EXTENSIONS = 'html.erb,html.haml,html' def self.matches?(request) pattern = file_pattern(request.path) Dir.glob(pattern).any? end private def self.file_pattern(page_id) "#{content_path}#{page_id}.{#{VIEW_EXTENSIONS}}" end def self.content_path Rails.root.join('app', 'views', HighVoltage.content_path).to_s end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
high_voltage-1.2.1 | lib/high_voltage/constraints/root_route.rb |