class Refinery::Pages::Engine
Protected Instance Methods
add_route_parts_as_reserved_words()
click to toggle source
Add any parts of routes as reserved words.
# File lib/refinery/pages/engine.rb, line 56 def add_route_parts_as_reserved_words ActiveSupport.on_load(:active_record) do # do not add routes with :allow_slug => true included_routes = Rails.application.routes.named_routes.to_a.reject{ |name, route| route.defaults[:allow_slug] } route_paths = included_routes.map { |name, route| route.path.spec } route_paths.reject! { |path| path.to_s =~ %r{^/(rails|refinery)}} Refinery::Pages.friendly_id_reserved_words |= route_paths.map { |path| path.to_s.gsub(%r{^/}, '').to_s.split('(').first.to_s.split(':').first.to_s.split('/') }.flatten.reject { |w| w =~ %r{_|\.} }.uniq end end
append_marketable_routes()
click to toggle source
# File lib/refinery/pages/engine.rb, line 49 def append_marketable_routes Refinery::Core::Engine.routes.append do get '*path', :to => 'pages#show', :as => :marketable_page end end