Sha256: ec5324e9f057eecd224e3eef8b3884ca34223edce06915ed17cd04f1a7f34003

Contents?: true

Size: 671 Bytes

Versions: 10

Compression:

Stored size: 671 Bytes

Contents

module StimulusReflex
  class RequestParameters
    def initialize(params:, req:, url:)
      @params = params
      @req = req
      @url = url
    end

    def apply!
      path_params = Rails.application.routes.recognize_path_with_request(@req, @url, @req.env[:extras] || {})
      path_params[:controller] = path_params[:controller].force_encoding("UTF-8")
      path_params[:action] = path_params[:action].force_encoding("UTF-8")

      @req.env.merge(ActionDispatch::Http::Parameters::PARAMETERS_KEY => path_params)
      @req.env["action_dispatch.request.parameters"] = @req.parameters.merge(@params)
      @req.tap { |r| r.session.send :load! }
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
stimulus_reflex-3.5.0.pre9 lib/stimulus_reflex/request_parameters.rb
stimulus_reflex-3.5.0.pre8 lib/stimulus_reflex/request_parameters.rb
stimulus_reflex-3.5.0.pre7 lib/stimulus_reflex/request_parameters.rb
stimulus_reflex-3.5.0.pre6 lib/stimulus_reflex/request_parameters.rb
stimulus_reflex-3.5.0.pre5 lib/stimulus_reflex/request_parameters.rb
stimulus_reflex-3.5.0.pre4 lib/stimulus_reflex/request_parameters.rb
stimulus_reflex-3.5.0.pre3 lib/stimulus_reflex/request_parameters.rb
stimulus_reflex-3.5.0.pre2 lib/stimulus_reflex/request_parameters.rb
stimulus_reflex-3.5.0.pre1 lib/stimulus_reflex/request_parameters.rb
stimulus_reflex-3.5.0.pre0 lib/stimulus_reflex/request_parameters.rb