In Rails, if I create a scaffold
foo, and do
rake db:migrate, then now
is created. So if I go to
script/console (or rails console for Rails 3)
it is empty.
$" is the loaded files. So foo.rb is not loaded yet.
Now I do a
Foo.all, and foo.rb should be loaded now.
But when I repeat the
grep, it is still showing empty array — why is that?
(On the other hand, I can grep for
pp, and it shows nothing, but after I
require 'pp', then the grep shows it)
It’s depend which environement you use.
In development time, it’s require and load only when you want and reload each time.
In production mode, it’s only require once and load once. It’s load on start of you application. All model on app/models are load.
The configuration to do that is :
config.cache_classes = true