Class: State

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

Overview

A state of the United States, or the District of Columbia.

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_counties ⇒ void

This method returns an undefined value.

Counts the counties of every state the count is wrong for, and touches none of the others.



14
15
16
17
# File 'app/models/state.rb', line 14

def self.recount_counties
  where("counties_count <> (#{counted_counties})").
    update_all [ "counties_count = (#{counted_counties}), 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).



20
# File 'app/models/state.rb', line 20

def to_s = name