jotto
10/14/2006 4:51:00 AM
I want to run a Ruby script outside of Rails and still use Active
Record. This is what I'm trying but I am getting a "const_missing"
error - do I need to reference the connection in the printlisting
method?:
require 'rubygems'
require 'active_record'
class TheMode < ActiveRecord::Base
def initialize
end
def printlisting
ActiveRecord::Base.establish_connection(:adapter => "mysql", :host =>
"localhost", :username => "root", :password => "root", :database =>
"commentstable")
listing = Comment.find(:all)
puts listing.text
end
temp = TheMode.new
temp.modemaker