ActiveRecordをCLIから使う

以下参照。
ActiveRecordを外部アプリケーション(rails以外)で使う

上記そのまま。

#!/usr/bin/env ruby

require '~/docs/www.example.com/app/config/boot'
require '~/docs/www.example.com/app/config/environment'

dbconfig = YAML.load_file('~/docs/www.example.com/app/config/database.yml')
ActiveRecord::Base.establish_connection(dbconfig['development'])

result = TestTable.find(:all, :conditions => {:test_id => 2})
result.each { |record|
    test_id   = record['test_id']
    another_id = record['another_id']
  puts "test_id:#{test_id},another_id:#{another_id}"
}

最初、ググったらactive_recordとyamlもrequireする例を見付けたのでそちらを試したらminitestの2.7.5以外がダブってるみたいなエラーが出て動かなかった。gem cleanupしてもbundle updateでも解決せず。
結局上記の記載で動いた。
こちらの環境はruby 2.0.0p451、rails 4.0.4。
3.x系とは違うのかもしれない。