Method: UnLocode::Locode.find_by_function

Defined in:
lib/un_locode/locode.rb

.find_by_function(function, limit = 10) ⇒ Object



22
23
24
25
# File 'lib/un_locode/locode.rb', line 22

def self.find_by_function function, limit = 10
  raise "Unsupported Locode Function! Should be one of #{UnLocode::FUNCTIONS.join(' ')}." unless UnLocode::FUNCTIONS.include?(function)
  includes(:country).where(function => true).limit(limit)
end