Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment