Class: County
- Inherits:
-
USA::Record
- Object
- ActiveRecord::Base
- USA::Record
- County
- 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
Class Method Summary collapse
-
.recount_zips ⇒ void
Counts the ZIPs of every county the count is wrong for, and touches none of the others.
Instance Method Summary collapse
-
#to_s ⇒ String
The default representation (used in views).
Methods inherited from USA::Record
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).
22 |
# File 'app/models/county.rb', line 22 def to_s = "#{name} (#{state.code})" |