Sha256: 4fecc6f0e9aa48040e935b3464202c6a004df6cde41572c19683fecd7882af50

Contents?: true

Size: 794 Bytes

Versions: 1

Compression:

Stored size: 794 Bytes

Contents

require 'action_dispatch/http/url'

module ActionDispatch::Http::URL
  
  ##
  # Enables automatic parameter propagation.
  #
  # This will only propagate within the current thread.  Child threads will not propagate.
  # This will not affect other requests in the current session.
  #
  #   ActionDispatch::Http::URL.propagated_params << :some_param
  def self.propagated_params
    @propagated_params ||= []
  end

  class << self
    alias :incline_original_path_for :path_for
  end

  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

    incline_original_path_for(options)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
incline-0.3.14 lib/incline/extensions/param_propagation.rb