Where to put my homegrown class?

I’ve developed a file (let’s call it mypdf.rb) which extends the module
PDF::Writer with some additional methods. This enables me to produce
PDF
documents of a very specific nature for a project I am working on.

I’ve developed and tested this outside the RoR framework. Now I want
to use
it within the context of a RoR application.

Where should I put the mypdf.rb file, so that I can define objects from
the
class ? Somewhere within the RoR application framework code ? Or
somewhere in the Ruby install tree ?

TIA

Phil Nelson

Philip N. wrote:

I’ve developed a file (let’s call it mypdf.rb) which extends the module
PDF::Writer with some additional methods. � This enables me to produce
PDF
documents of a very specific nature for a project I am working on.

I’ve developed and tested this outside the RoR framework. � Now I want
to use
it within the context of a RoR application.

Where should I put the mypdf.rb file, so that I can define objects from
the
class ? � Somewhere within the RoR application framework code ? � Or
somewhere in the Ruby install tree ?

TIA

Phil Nelson

Phil

You can put your mypdf.rb in <Your_App_Root>/lib and in your code you
can do

require ‘lib/mypdf’

-daya

On Aug 23, 2006, at 1:44 PM, Philip N. wrote:

Where should I put the mypdf.rb file, so that I can define objects
from the
class ? Somewhere within the RoR application framework code ? Or
somewhere in the Ruby install tree ?

rails_root/lib


Chris W.

On 8/23/06, Daya S. [email protected] wrote:

Phil

You can put your mypdf.rb in <Your_App_Root>/lib and in your code you
can do

require ‘lib/mypdf’

I am 95% sure that if you put the class in the root of lib (not in a
subdirectory) it will be autoloaded by Rails initializer. So don’t
need the explicity require. At least with version 1.1.6.