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

Version Path
landable-1.13.1 app/models/landable/asset_search_engine.rb
landable-1.12.3 app/models/landable/asset_search_engine.rb
landable-1.12.2 app/models/landable/asset_search_engine.rb
landable-1.12.1 app/models/landable/asset_search_engine.rb
landable-1.11.1 app/models/landable/asset_search_engine.rb
landable-1.11.0 app/models/landable/asset_search_engine.rb
landable-1.10.0.rc2 app/models/landable/asset_search_engine.rb
landable-1.10.0.rc1 app/models/landable/asset_search_engine.rb
landable-1.9.2 app/models/landable/asset_search_engine.rb
landable-1.9.1 app/models/landable/asset_search_engine.rb
landable-1.9.0 app/models/landable/asset_search_engine.rb
landable-1.9.0.rc2 app/models/landable/asset_search_engine.rb
landable-1.9.0.rc1 app/models/landable/asset_search_engine.rb
landable-1.8.0 app/models/landable/asset_search_engine.rb
landable-1.7.1.rc1 app/models/landable/asset_search_engine.rb
landable-1.7.0 app/models/landable/asset_search_engine.rb