usa 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +6 -1
- data/app/models/usa/city.rb +3 -0
- data/app/models/usa/county.rb +3 -0
- data/app/models/usa/state.rb +3 -0
- data/app/models/usa/zip.rb +3 -0
- data/lib/usa/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: baafe271decb488334f07d38d4312f97c37a031cbfe8d142fc91d0c6b9de0f9a
|
|
4
|
+
data.tar.gz: 17800009d94fccacc4f14845549909084552018624996963fed80d72630a79d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91179ce7f344c77569bcee54f8b15a4c0afd2781f7658a8d225ea353a4b44d43ddca5c9d1efbbdcfacf1eb8ec062c455730364bc99893571b9962961ea7a4284
|
|
7
|
+
data.tar.gz: bdac914175b069d651ea61be39d48896cee8401506a415f7a399d7607226f9a7175f30fd7b8f3c09d243253dcfae958be3b41941b52cc9ffafc87c9e6327a17e
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ For more information about changelogs, check [Keep a Changelog](http://keepachan
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## 0.3.0 - 2026-09-14
|
|
11
|
+
|
|
12
|
+
* [Feature] Every model answers by the word a host means rather than by the table under it:
|
|
13
|
+
`zips_path`, `zip[...]`, `zips/_row`, and the i18n key `zip`, while the table stays
|
|
14
|
+
`usa_zips`. Same for a state, a county and a city. A host that lists these records writes
|
|
15
|
+
what it would have written for a model of its own, and a gem that resolves a model from a
|
|
16
|
+
route -- recourse does -- finds it without being told
|
|
17
|
+
|
|
10
18
|
## 0.2.0 - 2026-09-14
|
|
11
19
|
|
|
12
20
|
* [Feature] `google_place_id` filled for every state and ZIP, and for the twenty counties that
|
data/README.md
CHANGED
|
@@ -12,7 +12,7 @@ To install on your system, run
|
|
|
12
12
|
|
|
13
13
|
To use inside a bundled Ruby project, add this line to the `Gemfile`:
|
|
14
14
|
|
|
15
|
-
gem 'usa', '~> 0.
|
|
15
|
+
gem 'usa', '~> 0.3.0'
|
|
16
16
|
|
|
17
17
|
Below 1.0 the pin stops at the next minor rather than the next major, because that is where a
|
|
18
18
|
breaking change may still land. It becomes `~> 1.0` once the API is settled on purpose.
|
|
@@ -88,6 +88,11 @@ nothing about:
|
|
|
88
88
|
ActiveSupport.on_load(:usa_record) { connects_to database: { writing: :primary, reading: :reader } }
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
+
Each model answers by the word you mean rather than by the table under it, so a page listing
|
|
92
|
+
ZIPs writes `zips_path`, a form posts `zip[...]`, a partial lives at `zips/_row` and a locale
|
|
93
|
+
key reads `zip` -- while the table stays `usa_zips`. A gem that resolves a model from a route
|
|
94
|
+
finds it without being told.
|
|
95
|
+
|
|
91
96
|
Columns of your own go on these tables in a migration of your own. They survive every seed: this
|
|
92
97
|
gem writes only the columns it ships.
|
|
93
98
|
|
data/app/models/usa/city.rb
CHANGED
|
@@ -14,6 +14,9 @@ class USA::City < USA::Record
|
|
|
14
14
|
# @return [String] the default representation (used in views).
|
|
15
15
|
def to_s = "#{name} (#{state.code})"
|
|
16
16
|
|
|
17
|
+
# The name Rails reads off this model: its route, its param key, its partial, its key.
|
|
18
|
+
def self.model_name = ActiveModel::Name.new(self, nil, 'City')
|
|
19
|
+
|
|
17
20
|
class << self
|
|
18
21
|
private
|
|
19
22
|
|
data/app/models/usa/county.rb
CHANGED
|
@@ -24,6 +24,9 @@ class USA::County < USA::Record
|
|
|
24
24
|
# @return [String] the default representation (used in views).
|
|
25
25
|
def to_s = "#{name} (#{state.code})"
|
|
26
26
|
|
|
27
|
+
# The name Rails reads off this model: its route, its param key, its partial, its key.
|
|
28
|
+
def self.model_name = ActiveModel::Name.new(self, nil, 'County')
|
|
29
|
+
|
|
27
30
|
class << self
|
|
28
31
|
private
|
|
29
32
|
|
data/app/models/usa/state.rb
CHANGED
|
@@ -22,6 +22,9 @@ class USA::State < USA::Record
|
|
|
22
22
|
# @return [String] the default representation (used in views).
|
|
23
23
|
def to_s = name
|
|
24
24
|
|
|
25
|
+
# The name Rails reads off this model: its route, its param key, its partial, its key.
|
|
26
|
+
def self.model_name = ActiveModel::Name.new(self, nil, 'State')
|
|
27
|
+
|
|
25
28
|
class << self
|
|
26
29
|
private
|
|
27
30
|
|
data/app/models/usa/zip.rb
CHANGED
|
@@ -11,6 +11,9 @@ class USA::ZIP < USA::Record
|
|
|
11
11
|
# @return [String] the default representation (used in views).
|
|
12
12
|
def to_s = code
|
|
13
13
|
|
|
14
|
+
# The name Rails reads off this model: its route, its param key, its partial, its key.
|
|
15
|
+
def self.model_name = ActiveModel::Name.new(self, nil, 'ZIP')
|
|
16
|
+
|
|
14
17
|
class << self
|
|
15
18
|
private
|
|
16
19
|
|
data/lib/usa/version.rb
CHANGED