Skip to content

Instantly share code, notes, and snippets.

@timothyf
Created July 21, 2010 18:51
Show Gist options
  • Save timothyf/484935 to your computer and use it in GitHub Desktop.
Save timothyf/484935 to your computer and use it in GitHub Desktop.
Using ActiveRecord Outside of Rails
require "rubygems"
require_gem "activerecord"
ActiveRecord::Base.establish_connection (
:adapter => "mysql",
:host => "localhost",
:username => "root",
:database => "HumanResources")
class Employee < ActiveRecord::Base
end
employee = Employee.new
employee.first_name = "Fred"
employee.last_name = "Flinstone"
employee.save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment