What's the Right Rails Prologue for a Standalone Program

I am trying to write a small program to exercise certain of my Rails
classes without having to go through a browser.

I have a file that like this:
########### filer_convert.rb #################
require File.dirname(FILE) + ‘/…/…/config/boot’
require ‘filer’

Filer.convert(10)

#########################################

I want to use it to debug the Filer.convert method inside an IDE
(Komodo). filer.rb could be simply this:

############ filer.rb #######################
class Filer < ActiveRecord::Base
end
#########################################

I was hoping that the prelude to this file, the first two require
statements would be enough to allow me to
test rails classes. When I debug this, though, I get the error
something like “undefined constant Active Record”. I suspect there is
more that I need in the prelude to filer_convert.rb to get the whole
panopoly of rails functionality, but can’t figure out what it is.

What should be ‘required’ at the beginning of filer_convert.rb to
bring in all of rails?

Thank.

Thanks, pharrinton. That did it. I still get a strange internal
error message when I run it under komodo, but I assume that’s
a komodo issue.

On Sep 20, 3:55 pm, ddoherty03 [email protected] wrote:

#########################################
statements would be enough to allow me to
test rails classes. When I debug this, though, I get the error
something like “undefined constant Active Record”. I suspect there is
more that I need in the prelude to filer_convert.rb to get the whole
panopoly of rails functionality, but can’t figure out what it is.

What should be ‘required’ at the beginning of filer_convert.rb to
bring in all of rails?

Thank.

You need to include environment.rb, not boot.rb (boot.rb will load
Rails itself, but not much actually happens without a defined Rails
environmen).

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs