------art_40544_11540183.1160804600244
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 10/13/06, jotto <jonathan.otto / gmail.com> wrote:
>
> 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  omment.find(:all)
>   puts listing.text
> end
>
> temp  heMode.new
> temp.modemaker



require 'comment'

Rails autoloads constants in lib, app/models, etc. When you use Active
Record on its own, you need to handle that yourself.

Best,
jeremy

------art_40544_11540183.1160804600244--