Skip to content

Instantly share code, notes, and snippets.

@billturner
Created December 22, 2009 05:58
Show Gist options
  • Save billturner/261542 to your computer and use it in GitHub Desktop.
Save billturner/261542 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'active_record'
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:database => 'jasons_db',
:username => 'root',
:password => 'password',
:host => 'localhost')
class Video < ActiveRecord::Base
# this assumes a table name videos in the jasons_db database
# with a primary key, auto incrementing, named id
end
Video.all.each do |video|
puts "This video's title is #{video.title}!"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment