Skip to content

Instantly share code, notes, and snippets.

@perlmunger
Created September 21, 2013 19:10
Show Gist options
  • Save perlmunger/6653288 to your computer and use it in GitHub Desktop.
Save perlmunger/6653288 to your computer and use it in GitHub Desktop.
Add all of the US states to a Rails model from the console with one line
# Here's what it looks like over multiple lines. Use the single line
# one below in the console or it won't work.
# ["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL",
# "IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT",
# "NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI",
# "SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY","AS","DC",
# "FM","GU","MH","MP","PW","PR","VI",
# "AE","AA","AE","AE","AE","AP"].each { |st| group = Group.new( :name => st); group.save }
["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY","AS","DC","FM","GU","MH","MP","PW","PR","VI","AE","AA","AE","AE","AE","AP"].each { |st| group = Group.new( :name => st); group.save }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment