Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (27 sloc) 0.859 kb
if defined?(ActionDispatch::Journey) # rails 4
journey = ActionDispatch::Journey
else # rails 3.2
require 'journey/routes'
require 'journey/router'
journey = Journey
end
journey::Routes.class_eval do
def filters
@filters || RoutingFilter::Chain.new.tap { |f| @filters = f unless frozen? }
end
end
journey::Router.class_eval do
def find_routes_with_filtering env
path, filter_parameters = env['PATH_INFO'], {}
original_path = path.dup
@routes.filters.run(:around_recognize, path, env) do
filter_parameters
end
find_routes_without_filtering(env).map do |match, parameters, route|
[ match, parameters.merge(filter_parameters), route ]
end.tap do |match, parameters, route|
env['PATH_INFO'] = original_path # restore the original path
end
end
alias_method_chain :find_routes, :filtering
end
Jump to Line
Something went wrong with that request. Please try again.