/script/console questions

If I am right, when starting script/console (or script/server), models
are not automatically required.

But with you type MyModel.find(:first) in the console, it works. Is
there any kind of method_missing implemented somewhere that does the
require when console is feeded MyModel ?


Yeah. ActiveSupport dependency checking in activesupport/lib/active_support/dependencies.rb

In this case, it builds off of Module#const_missing.


That's it, the callback is called const_missing.

That's not something specific to the console, it is a Rails feature. Note that a typical Rails application does not need to require their controllers, models, helpers, ..., but you should in regular Ruby. That's the reason.

-- fxn