Class: Pilipinas::Province

Inherits:
Base
  • Object
show all
Defined in:
lib/pilipinas/province.rb

Overview

Represents a province (or province-equivalent district) of the Philippines.

Provinces belong to a Region and contain one or more City records.

Examples:

province = Pilipinas::Province.find_by(name: "CAMARINES SUR")
province.cities  # => [#<City ...>, ...]

Instance Attribute Summary

Attributes inherited from Base

#code, #name

Instance Method Summary collapse

Methods inherited from Base

#==, all, assoc_collection, count, find_by, find_by_code, find_by_name, first, #hash, #initialize, #inspect, last, method_missing, reset_cache, respond_to_missing?, #to_s

Constructor Details

This class inherits a constructor from Pilipinas::Base

Instance Method Details

#citiesArray<City>

Returns the cities/municipalities belonging to this province.

Results are cached after the first call.

Returns:



18
19
20
# File 'lib/pilipinas/province.rb', line 18

def cities
  City.assoc_collection(code: code, dir: :provinces)
end