Andrew T. wrote:
On Thu, Apr 9, 2009 at 11:26 AM, Sijo Kg
[email protected] wrote:
Posted via http://www.ruby-forum.com/.
You could but if it’s not a model, why put it in a folder labelled
There is some room for debate here in terms of the definition of a model
object. After all in a truly pure sense of the MVC design pattern a
model object can be as simple as the String class all the way up to a
class a complex as ActiveRecord. After all, what does a String object
do? It manages the interface to a set of data, which is the array of
characters. It abstracts and encapsulates the storage of that set of
data. So in a pure sense it is a model object.
That’s the interesting thing about the MVC pattern. There is no
absolutes. It all depends on the definitions and usage in particular
It’s purely for code organisation, and Rails uses the folder names for
some of it’s auto load magic.
I completely agree with this. Applying MVC inside the context of Rails
will make others that might want to work with you on your code happy.
Typically the stuff in app/models are subclasses of ActiveRecord (or
other ORM style model classes). And the lib folder is typically used for
classes and modules that provide some shared behavior, whether they be
“model” objects or not.