Skip to content

Instantly share code, notes, and snippets.

@esmarkowski
Created April 13, 2011 21:38
Show Gist options
  • Save esmarkowski/918483 to your computer and use it in GitHub Desktop.
Save esmarkowski/918483 to your computer and use it in GitHub Desktop.
# addressable.rb
module Schemata
module Schema
def addressable
apply_schema :street_address_1, String
apply_schema :street_address_2, String
apply_schema :city, String
apply_schema :state, String
apply_schema :zip_code, String
apply_schema :country, String
end
end
end
#provides your migration file with
create_table :accounts do |t|
t.addressable
end
# instead of The Old Way
create_table :accounts do |t|
t.string "street_address_1"
t.string "street_address_2"
t.string "city"
t.string "state"
t.string "zip_code"
t.string "country"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment