Models without model?


Hi people

I’m a complete new to rails, so sorry in advance for the stupid
that I invariable will ask. I’m hoping that this one isn’t one of such
questions :slight_smile:

While looking through my logs, i’ve found the following statement a few

DEPRECATION WARNING: model is deprecated and will be removed from Rails
See for details.

However, i’m finding that I need to explicitly call model for each of my
models which are contained in the engine i’m building. At the moment
being mixed into the ApplicationController so that everything can use
models. Am I doing something wrong, or is this a known problem?


So if you don’t include the ‘model’ directive then your controllers
can’t load your models? Is that right?

Can you load them automatically from the console? (i.e. without a
‘require’ statement)

  • James


This problem actually turned out to be related to the problem in my
e-mail with the controllers not loading. Before I changed engines.rb to
modify Dependencies.load_paths as well, they would not load
automatically in
the console (and i’m presuming in a controller as well), but after the
they would load automatically. Before the fix tho, they would still load
you specifically said model :user, or etc.

My 2 cents is that $LOAD_PATH is only being used if you specifically ask
to load something, while Dependencies.load_paths is being used for
loading. However, the first time I knew what any of those two variables
was about an hour ago (and I still don’t really understand it), so take
for a grain of salt.


OK - let’s drop this thread and focus on the other one. I’ll reply in
more detail there.