Sha256: afd64b727a4aabff91c0275c1ecbfa7642f01f94d17cc3ff57833f2ef548b2f2
Contents?: true
Size: 471 Bytes
Versions: 16
Compression:
Stored size: 471 Bytes
Contents
require_dependency "landable/search_engine" require_dependency "landable/asset" module Landable class AssetSearchEngine < SearchEngine def initialize(filters) super Asset.all, filters end def filter_by!(filters) if ids = as_array(filters[:ids]) @scope = @scope.where(asset_id: ids) end if name = filters[:name].presence @scope = @scope.where('LOWER(name) LIKE ?', "%#{name}%".downcase) end end end end
Version data entries
16 entries across 16 versions & 1 rubygems