いつもググってる気がするのでシリーズ。

require 'rubygems'                                                                                                                                               
require 'active_record'                                                         

ActiveRecord::Base.establish_connection(
  :adapter  => 'postgresql',
  :host => 'localhost',
  :username => 'komagata',
  :password => '',
  :database => 'foo',
  :port => 5432
)

class Post < ActiveRecord::Base
end

puts Post.first.name

Comments


Option