require "#{Eitil::Engine.root.to_s}/config/initializers/wrappers/scopes/default_scopes.rb" module ApplicationRecordMonkey extend ActiveSupport::Concern included do class << self def all_associations reflect_on_all_associations.map do |assoc| { assoc.name => assoc.association_class.to_s.demodulize } end.inject &:merge end def where_like(_hash) column, like = _hash.first where("LOWER(#{column}) LIKE ?", "%#{like.downcase}%") end def find_by_like(_hash) column, like = _hash.first find_by("LOWER(#{column}) LIKE ?", "%#{like.downcase}%") end end end end ApplicationRecord.send :include, ApplicationRecordMonkey