-
-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Address model, Factory, Addresses::Country and Addresses::Region (#…
…635) * add Addresses::Country and Addresses::Region * add Address model, factory * add snail gem * tangible_thing_test: check address fields refresh on country change * remove snail gem * add Addresses::Continent and Addresses::Subcontinent * tests: fix find_stimulus_controller_for_label to permit multiple controllers * fix a merge conflict that snuck through * make the linter happy --------- Co-authored-by: Jeremy Green <jeremy@octolabs.com>
- Loading branch information
1 parent
500c1db
commit 29768d5
Showing
10 changed files
with
163 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class Address < ApplicationRecord | ||
extend ActiveHash::Associations::ActiveRecordExtensions | ||
|
||
include Addresses::Base | ||
# 🚅 add concerns above. | ||
|
||
# 🚅 add belongs_to associations above. | ||
|
||
# 🚅 add has_many associations above. | ||
|
||
# 🚅 add oauth providers above. | ||
|
||
# 🚅 add has_one associations above. | ||
|
||
# 🚅 add scopes above. | ||
|
||
# 🚅 add validations above. | ||
|
||
# 🚅 add callbacks above. | ||
|
||
# 🚅 add delegations above. | ||
|
||
# 🚅 add methods above. | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class Addresses::Continent < ApplicationHash | ||
include Addresses::Continents::Base | ||
# 🚅 add concerns above. | ||
|
||
# 🚅 add belongs_to associations above. | ||
|
||
# 🚅 add has_many associations above. | ||
|
||
# 🚅 add oauth providers above. | ||
|
||
# 🚅 add has_one associations above. | ||
|
||
# 🚅 add scopes above. | ||
|
||
# 🚅 add validations above. | ||
|
||
# 🚅 add callbacks above. | ||
|
||
# 🚅 add delegations above. | ||
|
||
# 🚅 add methods above. | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class Addresses::Country < ApplicationHash | ||
include Addresses::Countries::Base | ||
# 🚅 add concerns above. | ||
|
||
# 🚅 add belongs_to associations above. | ||
|
||
# 🚅 add has_many associations above. | ||
|
||
# 🚅 add oauth providers above. | ||
|
||
# 🚅 add has_one associations above. | ||
|
||
# 🚅 add scopes above. | ||
|
||
# 🚅 add validations above. | ||
|
||
# 🚅 add callbacks above. | ||
|
||
# 🚅 add delegations above. | ||
|
||
# 🚅 add methods above. | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class Addresses::Region < ApplicationHash | ||
include Addresses::Regions::Base | ||
# 🚅 add concerns above. | ||
|
||
# 🚅 add belongs_to associations above. | ||
|
||
# 🚅 add has_many associations above. | ||
|
||
# 🚅 add oauth providers above. | ||
|
||
# 🚅 add has_one associations above. | ||
|
||
# 🚅 add scopes above. | ||
|
||
# 🚅 add validations above. | ||
|
||
# 🚅 add callbacks above. | ||
|
||
# 🚅 add delegations above. | ||
|
||
# 🚅 add methods above. | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class Addresses::Subcontinent < ApplicationHash | ||
include Addresses::Subcontinents::Base | ||
# 🚅 add concerns above. | ||
|
||
# 🚅 add belongs_to associations above. | ||
|
||
# 🚅 add has_many associations above. | ||
|
||
# 🚅 add oauth providers above. | ||
|
||
# 🚅 add has_one associations above. | ||
|
||
# 🚅 add scopes above. | ||
|
||
# 🚅 add validations above. | ||
|
||
# 🚅 add callbacks above. | ||
|
||
# 🚅 add delegations above. | ||
|
||
# 🚅 add methods above. | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class CreateAddresses < ActiveRecord::Migration[7.0] | ||
def change | ||
create_table :addresses do |t| | ||
t.references :addressable, polymorphic: true, null: false | ||
t.string :address_one | ||
t.string :address_two | ||
t.string :city | ||
t.integer :region_id | ||
t.string :region_name | ||
t.integer :country_id | ||
t.string :postal_code | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FactoryBot.define do | ||
factory :address do | ||
addressable { nil } | ||
address_one { "1000 Vin Scully Avenue" } | ||
address_two { nil } | ||
city { "Los Angeles" } | ||
region_id { 1416 } | ||
region_name { "California" } | ||
country_id { 233 } | ||
postal_code { "90090" } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters