Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

active record test (See related posts)

ActiveRecord testing code

   1  
   2  require 'rubygems'
   3  require 'active_record'
   4  
   5  ActiveRecord::Base.establish_connection(
   6    :adapter => "mysql",
   7    :username => "root",
   8    :password => "root",
   9    :database => "blog",
  10    :host => "localhost" )
  11  
  12  class Blog < ActiveRecord::Base 
  13    set_table_name "posts"
  14    set_primary_key "id"
  15  end
  16  
  17  blog = Blog.find(:all)
  18  blog.each { |row|
  19    p row
  20  }

You need to create an account or log in to post comments to this site.


Click here to browse all 5555 code snippets

Related Posts