Forum: Ruby on Rails Custom command line libraries for controllers and rails

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Berlin B. (Guest)
on 2006-05-29 23:52
(Received via mailing list)
I have a library that is basically used on the command-line.  I am
trying to fit it in for my rails application.  So far it works, but I
was worried about how rails does caching or anything else.  Basically,
is this an ok approach.

So far, I put the library in RAILS_APP/lib/bot.rb

And 'bot.rb' contains a class 'VM'.

I have a controller:


And I put this at the top:

require File.dirname(__FILE__) + '/../../lib/bot'

And then I just allocate an instance in one my controller methods and
that is it.

Of course, there is one instance per request which is a little
wasteful.  But, that is my initial approach thus far.

Berlin B.
(ramaza3 on freenode)
also checkout alpha version of botverse:
This topic is locked and can not be replied to.