Hi Michael,
On 1/13/06, Michael Teter <mtrails@gmail.com>
wrote:>
> I''m seeking pointers to example code (ideally complete, small
> programs) in Ruby that use ActiveRecord without Rails.
>
> An added bonus would be if they happen to connect to SQL Server, but
> I''ll take what I can get. Mainly I just need a jump-start to
using
> ActiveRecord outside Rails.
>
>
I can''t *point* to any examples, but I just happened to be working on
one
right now.
It''s quite simple:
require ''author'' # Your model which inherits from
ActiveRecord::Base
ActiveRecord::Base.establish_connection (
:adapter => "mysql",
:host => "host",
:username => "username",
:password => "password",
:database => "database"
)
Author.find(:all)
ActiveRecord::Base.remove_connection()
-Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060113/e31b9cb7/attachment.html