Sha256: eeda4008611723393a70dc96aa65d16c7a30f32f370aeaa7e48a4eaa2381e9fb

Contents?: true

Size: 446 Bytes

Versions: 11

Compression:

Stored size: 446 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("LOWER(#{column}) LIKE ?", "%#{like.downcase}%")
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
eitil-1.1.30 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.1.29 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.1.28 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.1.27 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.1.26 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.1.25 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.1.24 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.1.23 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.1.22 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.1.21 eitil_core/lib/eitil_core/application_record/find_by_like.rb
eitil-1.1.20 eitil_core/lib/eitil_core/application_record/find_by_like.rb