Skip to content

Instantly share code, notes, and snippets.

@jessenaiman
Created July 19, 2013 18:59
Show Gist options
  • Save jessenaiman/6041515 to your computer and use it in GitHub Desktop.
Save jessenaiman/6041515 to your computer and use it in GitHub Desktop.
class Riding < ActiveRecord::Base
attr_accessible :poll_stations
#has_many :poll_street_indices
has_many :poll_stations
end
#######################################################
class PollStation < ActiveRecord::Base
attr_accessible :electoral_district, :poll_division, :location, :address1, :address2, :place
belongs_to :riding
end
#######################################################
class CreatePollStations < ActiveRecord::Migration
def self.up
create_table :poll_stations do |t|
t.integer :electoral_district
t.integer :poll_division
t.string :location
t.string :address1
t.string :address2
t.string :place
t.references :riding
t.timestamps
end
end
def self.down
drop_table :poll_stations
end
end
########################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment