Sha256: 8e7903e8ec8163bb5503411862600af883715f9ac11c807adc1b8e7ec621a0b3

Contents?: true

Size: 476 Bytes

Versions: 38

Compression:

Stored size: 476 Bytes

Contents

# require "eitil_core/application_record/find_by_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 FindByLike

      Eitil::ApplicationRecordModules << self

      def find_by_like(_hash)
        column, like = _hash.first
        find_by("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/find_by_like.rb
eitil-2.0.7 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-2.0.6 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-2.0.5 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-2.0.4 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-2.0.3 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-2.0.2 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-2.0.1 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-2.0.0 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.4.1 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.4.0 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.3.12 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.3.11 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.3.10 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.3.9 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.3.8 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.3.7 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.3.6 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.3.5 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.3.4 eitil_core/lib/eitil_core/application_record/find_by_like.rb