J
jotto
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",
assword => "root", :database =>
"commentstable")
listing = Comment.find
all)
puts listing.text
end
temp = TheMode.new
temp.modemaker
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
"localhost", :username => "root",
"commentstable")
listing = Comment.find
puts listing.text
end
temp = TheMode.new
temp.modemaker