Sha256: e46c4775f0fc7101cedb54d8a6b8a2a1db69cf671ea00ffe11fd6fa570404a3a

Contents?: true

Size: 966 Bytes

Versions: 2

Compression:

Stored size: 966 Bytes

Contents

require ::File.join(Earth::VENDOR_DIR, 'geokit-rails', 'lib', 'geokit-rails')

class ZipCode < ActiveRecord::Base
  self.primary_key = "name"
  
  belongs_to :egrid_subregion,  :foreign_key => 'egrid_subregion_abbreviation'
  belongs_to :climate_division, :foreign_key => 'climate_division_name'
  belongs_to :state,            :foreign_key => 'state_postal_abbreviation'
  has_many :electric_markets,   :foreign_key => 'zip_code_name'
  has_many :electric_utilities, :through => :electric_markets
  
  def country
    Country.united_states
  end
  
  def latitude_longitude
    [latitude, longitude]
  end
  
  acts_as_mappable :default_units => :kilometres,
                   :lat_column_name => :latitude,
                   :lng_column_name => :longitude
  
  col :name
  col :state_postal_abbreviation
  col :description
  col :latitude
  col :longitude
  col :egrid_subregion_abbreviation
  col :climate_division_name
  col :population, :type => :integer
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
earth-0.11.20 lib/earth/locality/zip_code.rb
earth-0.11.19 lib/earth/locality/zip_code.rb