mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Added list of geocoded suburbs.
This commit is contained in:
3
app/models/suburb.rb
Normal file
3
app/models/suburb.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class Suburb < ActiveRecord::Base
|
||||
belongs_to :state, :class_name => Spree::State
|
||||
end
|
||||
11
db/migrate/20130806055125_create_suburbs.rb
Normal file
11
db/migrate/20130806055125_create_suburbs.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class CreateSuburbs < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :suburbs do |t|
|
||||
t.string :name
|
||||
t.integer :postcode
|
||||
t.float :latitude
|
||||
t.float :longitude
|
||||
t.integer :state_id
|
||||
end
|
||||
end
|
||||
end
|
||||
10
db/schema.rb
10
db/schema.rb
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130801012854) do
|
||||
ActiveRecord::Schema.define(:version => 20130806055125) do
|
||||
|
||||
create_table "cms_blocks", :force => true do |t|
|
||||
t.integer "page_id", :null => false
|
||||
@@ -865,4 +865,12 @@ ActiveRecord::Schema.define(:version => 20130801012854) do
|
||||
t.integer "zone_members_count", :default => 0
|
||||
end
|
||||
|
||||
create_table "suburbs", :force => true do |t|
|
||||
t.string "name"
|
||||
t.integer "postcode"
|
||||
t.float "latitude"
|
||||
t.float "longitude"
|
||||
t.integer "state_id"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
12
db/seeds.rb
12
db/seeds.rb
@@ -28,6 +28,12 @@ unless Spree::State.find_by_name 'Victoria'
|
||||
end
|
||||
|
||||
# -- Landing page images
|
||||
LandingPageImage.create photo: File.open(File.join(Rails.root, "lib", "seed_data", "carrots.jpg"))
|
||||
LandingPageImage.create photo: File.open(File.join(Rails.root, "lib", "seed_data", "tomatoes.jpg"))
|
||||
LandingPageImage.create photo: File.open(File.join(Rails.root, "lib", "seed_data", "potatoes.jpg"))
|
||||
unless LandingPageImage.find_by_photo_file_name("potatoes.jpg")
|
||||
LandingPageImage.create photo: File.open(File.join(Rails.root, "lib", "seed_data", "carrots.jpg"))
|
||||
LandingPageImage.create photo: File.open(File.join(Rails.root, "lib", "seed_data", "tomatoes.jpg"))
|
||||
LandingPageImage.create photo: File.open(File.join(Rails.root, "lib", "seed_data", "potatoes.jpg"))
|
||||
end
|
||||
|
||||
# -- Seeding suburbs
|
||||
require_relative './suburb_seeds'
|
||||
SuburbSeeder.seed_suburbs unless Suburb.find_all_by_name("Dayton")
|
||||
|
||||
16897
db/suburb_seeds.rb
Normal file
16897
db/suburb_seeds.rb
Normal file
File diff suppressed because it is too large
Load Diff
5
spec/models/suburb_spec.rb
Normal file
5
spec/models/suburb_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Suburb do
|
||||
it { should belong_to(:state) }
|
||||
end
|
||||
Reference in New Issue
Block a user