Created
April 13, 2011 21:38
-
-
Save esmarkowski/918483 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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