Module: ActionDispatch::Http::URL
- Defined in:
- lib/incline/extensions/param_propagation.rb
Class Method Summary collapse
- .path_for(options) ⇒ Object
-
.propagated_params ⇒ Object
Enables automatic parameter propagation.
Class Method Details
.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() if (request = Incline::current_request) propagated_params.each do |k| if request.params.key? k [:params] ||= {} [:params][k] = request.params[k] end end end path = [:script_name].to_s.chomp("/") path << [:path] if .key?(:path) add_trailing_slash(path) if [:trailing_slash] add_params(path, [:params]) if .key?(:params) add_anchor(path, [:anchor]) if .key?(:anchor) path end |
.propagated_params ⇒ Object
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
12 13 14 |
# File 'lib/incline/extensions/param_propagation.rb', line 12 def self.propagated_params @propagated_params ||= [] end |