Module: MagicAddresses::Translator::MoreClassMethods

Defined in:
lib/app/models/magic_addresses/translator.rb

Overview

M O R E - M E T H O D S # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

Instance Method Summary collapse

Instance Method Details

#search(search) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/app/models/magic_addresses/translator.rb', line 41

def search(search)
  field = self.respond_to?(:street_name) ? :street_name : :name
  if search
    with_translations.where("#{field} LIKE ?", "%#{search}%")
  else
    with_translations
  end
end