Forum: Ruby on Rails I'ts not a (db-)model, not controller - so is it a lib?

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.
4f8c518d1177f790894580962678a316?d=identicon&s=25 Tobias Grimm (tobias)
on 2006-12-31 00:34
(Received via mailing list)

I'm starting a test spike for a small Rails project, that doesn't have
any database backend. It's a kind of a (Debian Linux) system
administration utility like webmin that collects and displays system
informations, modifies config files at different locations and runs
system tasks like the installation of Debian packages.

I'm not sure yet, if Rails is the right tool for, but that's what I
want to figure out with a test spike. Even if I don't need any of the
ActiveRecord stuff, ActionController, the rhtml-template's,
Ajax-support  and so on seem to be useful enought to give Rails a try.

At this point I managed to make the unit tests work without a database
and have coded some simple controllers. But as it now becomes a little
bit more complex, a few questions came up:

1. I'm not using a database, so whenever I use some kind of model
class, I simply don't derive it from ActiveRecord. Such a model e.g. is
DebianPackage, which holds package information that were retrieved from
the Debian system. The question now is, does this class still belongs
to app/model/ ? or should non-DB backed models always go to lib/ ?

2. I have some classes that do stuff like retrieving cpu load info from
the system. These classes are some kind of service objects, not models
or controllers. Should they be put into lib/ ore somewhere else?

3. If I put the service object classes in lib/, where should the tests
for it go? Am I free to simply put them into test/ or test/services and
create a rake task for it?


This topic is locked and can not be replied to.