i need to require active record, but I am working outside of rails (here is why: Simple Ruby Input Validation Library). do I need to require the entire rails gem, or can i be DRYer?
+2
A:
Here's how I'm using ActiveRecord outside of Rails:
require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:database => "xxx_production",
:username => 'root',
:password => 'xxx',
:host => 'localhost'
)
class Order < ActiveRecord::Base
end
Order.all.each do |o|
...
Paweł Gościcki
2010-09-07 19:17:46