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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1138a018f777ee544ffaae4b4f0957bf583760a830bbb63f740143a1cff6552d
4
- data.tar.gz: 3279df99a0c654797aea3803142650dad7ef2f94f1521eb6d7617c959ec38b7b
3
+ metadata.gz: baafe271decb488334f07d38d4312f97c37a031cbfe8d142fc91d0c6b9de0f9a
4
+ data.tar.gz: 17800009d94fccacc4f14845549909084552018624996963fed80d72630a79d6
5
5
  SHA512:
6
- metadata.gz: e072a57248277ea92c26cd41d1d85a99f5a36d7abcb2d6dee8f36f1796564ec012bb2ef37cbd7309f73fbcd2542bbdffa9686c3b6b27e97f3f1a713e37eaf071
7
- data.tar.gz: a84c4a5ed0b32d98820b7df2521034a92a1da067753b82cf82b9a32b60366261d1841636919d1b761edf2d4c49071dba2961224c1ceee6da366b8ce76964b4a6
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.2.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
 
@@ -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
 
@@ -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
 
@@ -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
 
@@ -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
@@ -1,4 +1,4 @@
1
1
  module USA
2
2
  # The version of this gem, as RubyGems knows it.
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo