- Install Ruby
- Install active-record (plus any adapters... such as ODBC) on command line
gem install active_record --include-dependencies
gem install odbc-rails --include-dependencies
- Write some Ruby code...
The simplest case looks something like this:
# require AR
require 'rubygems' # require gems first since AR is installed via gems
# connect to the database (sqlite in this case)
:adapter => odbc,
:dsn => your_pre-configured_odbc_datasource_name,
:username => user_name,
:password => secred_password,
:trace => true,
:convert_numeric_literals => true})
# define your models - this one looks for a table called 'tasks'
class Task < ActiveRecord::Base
Then you're good to go! Go ahead and use all that Active Record stuff from a local script...
See here for futher info on using ODBC with rails:
The rails wiki has more on active record outside rails.