#! /usr/bin/env ruby -Ku
#
# 2008-06-06 katoy
#
# See
#  http://jp.rubyist.net/magazine/?cmd=view&p=0006-RubyOnRails&key=activerecord
#  http://dev.ariel-networks.com/articles/workshop/rails-activerecord

require 'rubygems'
require 'fastercsv'

require 'user'

ActiveRecord::Base.default_timezone = :utc
# logger = ActiveRecord::Base.logger = Logger.new(STDOUT)

ActiveRecord::Base.configurations = YAML.load_file('database.yml')
ActiveRecord::Base.establish_connection('development')

data = FasterCSV.read("data.csv")
data.each do |row|
  next if row.size == 0
  User.create!(:name => row[0], :occupation => row[1])
end


