Sha256: e2ca1ebdccad34a1e4e8e5ccc698a3caf4310bc7cc066fef6d13095b829a4b53
Contents?: true
Size: 429 Bytes
Versions: 1
Compression:
Stored size: 429 Bytes
Contents
module Feeder module Concerns::Helpers::Filter extend ActiveSupport::Concern included do scope :filter, ->(options) { args = [] wheres = options.each.map do |feedable, ids| ids = feedable.pluck :id if ids == :all args << feedable << ids "(feedable_type = ? AND feedable_id IN (?))" end.join " OR " where(wheres, *(args)) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
feeder-0.5.1 | lib/feeder/concerns/helpers/filter.rb |