Added list of geocoded suburbs.

This commit is contained in:
alexs
2013-08-06 18:31:08 +10:00
parent 57e185af78
commit 82ea8adfe3
6 changed files with 16934 additions and 4 deletions

3
app/models/suburb.rb Normal file
View File

@@ -0,0 +1,3 @@
class Suburb < ActiveRecord::Base
belongs_to :state, :class_name => Spree::State
end

View 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

View File

@@ -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

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
require 'spec_helper'
describe Suburb do
it { should belong_to(:state) }
end