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