Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "rubygems"
- require "activerecord"
- #Change this to reflect your database settings
- ActiveRecord::Base.establish_connection (
- :adapter => "mysql",
- :host => "localhost",
- :username => "root",
- :password => "password",
- :database => "some_database")
- #Now define your classes from the database as always
- class SomeClass < ActiveRecord::Base
- #blah, blah, blah
- end
- #Now do stuff with it
- some_class = SomeClass.new
- some_other_stuff = SomeClass.find :all
- require "active_record"
Add Comment
Please, Sign In to add comment