Method: ActionDispatch::Http::URL.path_for

Defined in:
lib/incline/extensions/param_propagation.rb

.path_for(options) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/incline/extensions/param_propagation.rb', line 16

def self.path_for(options)
  
  if (request = Incline::current_request)
    propagated_params.each do |k|
      if request.params.key? k
        options[:params] ||= {}
        options[:params][k] = request.params[k]
      end
    end
  end
  
  path  = options[:script_name].to_s.chomp("/")
  path << options[:path] if options.key?(:path)

  add_trailing_slash(path) if options[:trailing_slash]
  add_params(path, options[:params]) if options.key?(:params)
  add_anchor(path, options[:anchor]) if options.key?(:anchor)

  path
end