Sha256: 3d2bee542b0b508b1921fec026389c5fbbf93cf8887074dd4bb57dffe8246888

Contents?: true

Size: 470 Bytes

Versions: 38

Compression:

Stored size: 470 Bytes

Contents

# require "eitil_core/application_record/where_like"

# require "eitil_core/railtie" to run the dynamic dispatch as an init hook during boot
require "eitil_core/railtie"

module EitilCore
  module ApplicationRecord
    module WhereLike

      Eitil::ApplicationRecordModules << self

      def where_like(_hash)
        column, like = _hash.first
        where("REPLACE(LOWER(#{column}), ' ', '') LIKE ?", "%#{like.downcase.delete(' ')}%")
      end

    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
eitil-2.0.8 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-2.0.7 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-2.0.6 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-2.0.5 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-2.0.4 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-2.0.3 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-2.0.2 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-2.0.1 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-2.0.0 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-1.4.1 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-1.4.0 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-1.3.12 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-1.3.11 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-1.3.10 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-1.3.9 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-1.3.8 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-1.3.7 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-1.3.6 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-1.3.5 eitil_core/lib/eitil_core/application_record/where_like.rb
eitil-1.3.4 eitil_core/lib/eitil_core/application_record/where_like.rb