Class: County

Inherits:
USA::Record show all
Includes:
USA::Seeded
Defined in:
app/models/county.rb

Overview

A county, parish, borough or census area: the division every ZIP is counted under.

Constant Summary

Constants included from USA::Seeded

USA::Seeded::SLICE

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from USA::Record

table_name_prefix

Class Method Details

.recount_zips ⇒ void

This method returns an undefined value.

Counts the ZIPs of every county the count is wrong for, and touches none of the others.



16
17
18
19
# File 'app/models/county.rb', line 16

def self.recount_zips
  where("zips_count <> (#{counted_zips})").
    update_all [ "zips_count = (#{counted_zips}), updated_at = ?", Time.current ]
end

Instance Method Details

#to_s ⇒ String

Returns the default representation (used in views).

Returns:

  • (String) —

    the default representation (used in views).



22
# File 'app/models/county.rb', line 22

def to_s = "#{name} (#{state.code})"