Sha256: 4d114e514c3a928bd40fd2782b34a3010ea6e974bf5e1444a8ed698c2ac87624

Contents?: true

Size: 392 Bytes

Versions: 140

Compression:

Stored size: 392 Bytes

Contents

module WithScopedQueries::Filter
  def self.query_by(params, current_scope, _)
    params.to_h.inject(current_scope) do |scope, (field, value)|
      if value.present?
        scope.public_send("by_#{field}", value)
      else
        scope
      end
    end
  end

  def self.add_queriable_attributes_to(klass, attributes)
    klass.queriable_attributes.merge!(filter: attributes)
  end
end

Version data entries

140 entries across 140 versions & 2 rubygems

Version Path
mumuki-domain-9.23.0 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.22.1 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.22.0 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.21.0 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.20.0 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.19.0 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.18.0 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.17.0 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.16.0 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.15.0 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.14.1 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.14.0 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.13.1 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.13.0 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.12.0 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.11.0 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.10.0 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.9.0 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.8.1 app/models/concerns/with_scoped_queries/filter.rb
mumuki-domain-9.8.0 app/models/concerns/with_scoped_queries/filter.rb