Sha256: 279370879bf2323ac0094ddc972220937df24cf4e9019058f25f6f53df2737ee

Contents?: true

Size: 577 Bytes

Versions: 3

Compression:

Stored size: 577 Bytes

Contents

module ParamsKeeper::Controller
  extend ActiveSupport::Concern

  included do
    class_attribute :keep_params_config
    helper ParamsKeeper::Helper
  end

  def url_for(options = nil)
    ParamsKeeper::Resolver.new(self, self, options).resolve || super
  end

  class_methods do
    def keep_params(*args)
      self.keep_params_config = {
        keys: nil,
        to: nil,
        for: :hash,
        url_options: nil
      }
      self.keep_params_config.merge!(args.last.is_a?(Hash) ? args.pop : {})
      self.keep_params_config[:keys] = Array(args)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
params_keeper_rails-1.1.2 lib/params_keeper/controller.rb
params_keeper_rails-1.1.1 lib/params_keeper/controller.rb
params_keeper_rails-1.1.0 lib/params_keeper/controller.rb