class CreateStates < ActiveRecord::Migration
def self.up
create_table :states do |t|
t.column :code, :string
t.column :description, :string
t.column :display_order, :integer
t.column :active, :boolean, :default => false
t.column :created_at, :string
t.column :updated_at, :string
end
State.create(:code => 'AL', :description => 'Alabama')
State.create(:code => 'AK', :description => 'Alaska')
State.create(:code => 'AZ', :description => 'Arizona')
State.create(:code => 'AR', :description => 'Arkansas')
State.create(:code => 'CA', :description => 'California')
State.create(:code => 'CO', :description => 'Colorado')
State.create(:code => 'CT', :description => 'Connecticut')
State.create(:code => 'DE', :description => 'Delaware')
State.create(:code => 'FL', :description => 'Florida')
State.create(:code => 'GA', :description => 'Georgia')
State.create(:code => 'HI', :description => 'Hawaii')
State.create(:code => 'ID', :description => 'Idaho')
State.create(:code => 'IL', :description => 'Illinois')
State.create(:code => 'IN', :description => 'Indiana')
State.create(:code => 'IA', :description => 'Iowa')
State.create(:code => 'KS', :description => 'Kansas')
State.create(:code => 'KY', :description => 'Kentucky')
State.create(:code => 'LA', :description => 'Louisiana')
State.create(:code => 'ME', :description => 'Maine')
State.create(:code => 'MD', :description => 'Maryland')
State.create(:code => 'MA', :description => 'Massachusetts')
State.create(:code => 'MI', :description => 'Michigan')
State.create(:code => 'MN', :description => 'Minnesota')
State.create(:code => 'MS', :description => 'Mississippi')
State.create(:code => 'MO', :description => 'Missouri')
State.create(:code => 'MT', :description => 'Montana')
State.create(:code => 'NE', :description => 'Nebraska')
State.create(:code => 'NV', :description => 'Nevada')
State.create(:code => 'NH', :description => 'New Hampshire')
State.create(:code => 'NJ', :description => 'New Jersey')
State.create(:code => 'NM', :description => 'New Mexico')
State.create(:code => 'NY', :description => 'New York')
State.create(:code => 'NC', :description => 'North Carolina')
State.create(:code => 'ND', :description => 'North Dakota')
State.create(:code => 'OH', :description => 'Ohio')
State.create(:code => 'OK', :description => 'Oklahoma')
State.create(:code => 'OR', :description => 'Oregon')
State.create(:code => 'PA', :description => 'Pennsylvania')
State.create(:code => 'RI', :description => 'Rhode Island')
State.create(:code => 'SC', :description => 'South Carolina')
State.create(:code => 'SD', :description => 'South Dakota')
State.create(:code => 'TN', :description => 'Tennessee')
State.create(:code => 'TX', :description => 'Texas')
State.create(:code => 'UT', :description => 'Utah')
State.create(:code => 'VT', :description => 'Vermont')
State.create(:code => 'VA', :description => 'Virginia')
State.create(:code => 'WA', :description => 'Washington')
State.create(:code => 'WV', :description => 'West Virginia')
State.create(:code => 'WI', :description => 'Wisconsin')
State.create(:code => 'WY', :description => 'Wyoming')
end
def self.down
drop_table :states
end
end
Saturday, April 28, 2007
States of the Union
I needed a lookup table of states and their abbreviations for my application so I rolled my own migration. I read data in from a CSV file and wrote these State.create statements into a new text file. If you need the same kind of table, maybe you can reuse what I did. Don't repeat yourself :)
Sunday, April 22, 2007
TextMate: Yes!
I've been using Eclipse with RadRails ever since I started learning RoR last summer. I chose that combo mainly because I use Eclipse at work already and I'm familiar with the user interface. I heard a lot of praise for TextMate but passed it off until now. I just purchased a licencse last week and so far I AM IMPRESSED. You can purchase an hour long screencast from PeepCode and learn how to enhance your TextMate experience. TextMate is OS X only though, so Windows guys luck out *blows rasberries*
I'm anxious to see the development of Rails IDEs in the coming months. IntelliJ, NetBeans, and Eclipse are pushing for full RoR support. I wonder who will have the best...
Here's a screenshot of TextMate using the Ruby Blue Theme
I'm anxious to see the development of Rails IDEs in the coming months. IntelliJ, NetBeans, and Eclipse are pushing for full RoR support. I wonder who will have the best...
Here's a screenshot of TextMate using the Ruby Blue Theme

Saturday, April 14, 2007
Flexing My Ambitions
I attended the OC Java Users' Group meeting this past Thursday and was introduced to a very sexy front end solution - Adobe Flex. James Ward gave the presentation and I was really impressed how Adobe is bringing aesthetics to user interfaces. I started out as a graphic designer (a mediocre one) so there's a part of me that's still passionate about beautiful interfaces and better user experience.
I don't know if it's just my experience, but corporate development means adhering to design rules and company standards that end up restricting creativity. The UIs are nasty, ew. At least on the consumer facing side the interfaces are allowed to look good. See HarleyDavidson.com and ABC.com.
It looks like Flex is also available for Ruby on Rails. I'm curious how it all ties into a RoR backend and it's on my list of things to learn. Boy is that list getting long, so maybe I'll get around to it by the end of this year.
--
There's lots of discussion among my friends and coworkers about starting our own businesses. Personally, I've been exploring how I can use open source software to generate extra income each year. Honestly, I feel like I have the technical skills to implement IT solutions. The hard part comes when I'd have to deal with clients and provide support for them. I don't see how that's possible to do while working a full time job.
I don't know if it's just my experience, but corporate development means adhering to design rules and company standards that end up restricting creativity. The UIs are nasty, ew. At least on the consumer facing side the interfaces are allowed to look good. See HarleyDavidson.com and ABC.com.
It looks like Flex is also available for Ruby on Rails. I'm curious how it all ties into a RoR backend and it's on my list of things to learn. Boy is that list getting long, so maybe I'll get around to it by the end of this year.
--
There's lots of discussion among my friends and coworkers about starting our own businesses. Personally, I've been exploring how I can use open source software to generate extra income each year. Honestly, I feel like I have the technical skills to implement IT solutions. The hard part comes when I'd have to deal with clients and provide support for them. I don't see how that's possible to do while working a full time job.
Subscribe to:
Posts (Atom)
