Active Record Test
Join the DZone community and get the full member experience.
Join For FreeActiveRecord testing code
require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:username => "root",
:password => "root",
:database => "blog",
:host => "localhost" )
class Blog < ActiveRecord::Base
set_table_name "posts"
set_primary_key "id"
end
blog = Blog.find(:all)
blog.each { |row|
p row
}
Testing
Record (computer science)
Opinions expressed by DZone contributors are their own.
Comments