Class: Organization

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/organization.rb

Class Method Summary collapse

Class Method Details

.lookup(thing) ⇒ Object



7
8
9
10
# File 'app/models/organization.rb', line 7

def self.lookup(thing)
  candidate   = self.where(name: thing).first
  candidate ||= self.includes(:nicknames).joins(:nicknames).find_by("nicknames.nickname" => thing)
end