#! /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 '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')

#user = User.find(:first, :conditions => ["name = ?", 'David'])
#p user

result = User.find(:all)
p "size = #{result.size}"
result.each do |r|
  p "#{r.id} #{r.name} #{r.occupation}"
end

