diff --git a/app/models/location.rb b/app/models/location.rb
index b170f4209..ff97513c9 100644
--- a/app/models/location.rb
+++ b/app/models/location.rb
@@ -8,6 +8,7 @@
# latitude :float
# longitude :float
# province_state :string
+# zipcode :string
# created_at :datetime not null
# updated_at :datetime not null
#
diff --git a/app/models/organization.rb b/app/models/organization.rb
index 1c2e02496..caaf5f744 100644
--- a/app/models/organization.rb
+++ b/app/models/organization.rb
@@ -3,11 +3,8 @@
# Table name: organizations
#
# id :bigint not null, primary key
-# city :string
-# country :string
# name :string
# slug :string
-# zipcode :string
# created_at :datetime not null
# updated_at :datetime not null
#
diff --git a/app/views/organizations/home/index.html.erb b/app/views/organizations/home/index.html.erb
index a185f17de..2a3a28e8e 100644
--- a/app/views/organizations/home/index.html.erb
+++ b/app/views/organizations/home/index.html.erb
@@ -3,7 +3,7 @@
-
Rescue pets in <%= Current.organization.city %> at <%= Current.organization.name %>
+
Rescue pets near you at <%= Current.organization.name %>
Rescue a really cute pet and be a hero
-
diff --git a/db/migrate/20231003094720_remove_location_fields_from_organizations.rb b/db/migrate/20231003094720_remove_location_fields_from_organizations.rb
new file mode 100644
index 000000000..c5bbfc1ce
--- /dev/null
+++ b/db/migrate/20231003094720_remove_location_fields_from_organizations.rb
@@ -0,0 +1,15 @@
+class RemoveLocationFieldsFromOrganizations < ActiveRecord::Migration[7.0]
+ def up
+ safety_assured do
+ remove_column :organizations, :city, :string
+ remove_column :organizations, :country, :string
+ remove_column :organizations, :zipcode, :string
+ end
+ end
+
+ def down
+ add_column :organizations, :city, :string
+ add_column :organizations, :country, :string
+ add_column :organizations, :zipcode, :string
+ end
+end
diff --git a/db/migrate/20231003095748_add_zipcode_to_locations.rb b/db/migrate/20231003095748_add_zipcode_to_locations.rb
new file mode 100644
index 000000000..395df2236
--- /dev/null
+++ b/db/migrate/20231003095748_add_zipcode_to_locations.rb
@@ -0,0 +1,9 @@
+class AddZipcodeToLocations < ActiveRecord::Migration[7.0]
+ def up
+ add_column :locations, :zipcode, :string
+ end
+
+ def down
+ safety_assured { remove_column :locations, :zipcode, :string }
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 2882d2f77..2a78463f9 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[7.0].define(version: 2023_10_02_150909) do
+ActiveRecord::Schema[7.0].define(version: 2023_10_03_095748) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -145,6 +145,7 @@
t.float "longitude"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.string "zipcode"
end
create_table "matches", force: :cascade do |t|
@@ -160,9 +161,6 @@
create_table "organizations", force: :cascade do |t|
t.string "name"
- t.string "city"
- t.string "country"
- t.string "zipcode"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "slug"
diff --git a/db/seeds/01_alta.rb b/db/seeds/01_alta.rb
index 46de2b0b5..2ac7dd803 100644
--- a/db/seeds/01_alta.rb
+++ b/db/seeds/01_alta.rb
@@ -1,8 +1,5 @@
organization = Organization.create!(
name: "Alta Pet Rescue",
- city: "Alta",
- country: "Mexico",
- zipcode: "12345",
slug: "alta"
)
@@ -75,7 +72,8 @@
@location_one = Location.create!(
country: "Canada",
province_state: "Alberta",
- city_town: "Canmore"
+ city_town: "Canmore",
+ zipcode: "12345"
)
@adopter_profile_one = AdopterProfile.create!(
@@ -118,7 +116,8 @@
@location_two = Location.create!(
country: "USA",
province_state: "Nevada",
- city_town: "Reno"
+ city_town: "Reno",
+ zipcode: "12345"
)
@adopter_profile_two = AdopterProfile.create!(
@@ -164,7 +163,8 @@
@location_three = Location.create!(
country: "Nonsense",
province_state: "Nonsense",
- city_town: "Nonsense"
+ city_town: "Nonsense",
+ zipcode: "12345"
)
@adopter_profile_three = AdopterProfile.create!(
diff --git a/db/seeds/02_baja.rb b/db/seeds/02_baja.rb
index b8f323e21..48e535039 100644
--- a/db/seeds/02_baja.rb
+++ b/db/seeds/02_baja.rb
@@ -1,8 +1,5 @@
organization = Organization.create!(
name: "Baja",
- city: "Baja",
- country: "Mexico",
- zipcode: "12345",
slug: "baja"
)
ActsAsTenant.with_tenant(organization) do
@@ -74,7 +71,8 @@
@location_one = Location.create!(
country: "Canada",
province_state: "Alberta",
- city_town: "Canmore"
+ city_town: "Canmore",
+ zipcode: "12345"
)
@adopter_profile_one = AdopterProfile.create!(
@@ -117,7 +115,8 @@
@location_two = Location.create!(
country: "USA",
province_state: "Nevada",
- city_town: "Reno"
+ city_town: "Reno",
+ zipcode: "12345"
)
@adopter_profile_two = AdopterProfile.create!(
@@ -163,7 +162,8 @@
@location_three = Location.create!(
country: "Nonsense",
province_state: "Nonsense",
- city_town: "Nonsense"
+ city_town: "Nonsense",
+ zipcode: "12345"
)
@adopter_profile_three = AdopterProfile.create!(
diff --git a/test/factories.rb b/test/factories.rb
index 20e647c44..9b3f7536b 100644
--- a/test/factories.rb
+++ b/test/factories.rb
@@ -78,6 +78,7 @@
city_town { Faker::Address.city }
sequence(:country) { |n| "Country#{n}" }
province_state { Faker::Address.state }
+ zipcode { Faker::Address.zip_code }
trait :with_adopter_profile do
after :create do |location|