# /script/console questions

**URL:** <https://www.ruby-forum.com/t/script-console-questions/105591>\
**Category:** Rails\
**Created:** [May 31, 2007, 2:42pm UTC](https://www.ruby-forum.com/t/script-console-questions/105591 "2007-05-31T14:42:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bartocc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c68b51/32.png) [@bartocc](https://www.ruby-forum.com/u/bartocc)\
**Post date:** [May 31, 2007, 2:42pm UTC](https://www.ruby-forum.com/t/script-console-questions/105591/1 "2007-05-31T14:42:10Z")

</div>

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 ?

Thx  
Julien

---

<div class="post-metadata">

**Author:** ![bartocc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c68b51/32.png) [@bartocc](https://www.ruby-forum.com/u/bartocc)\
**Post date:** [May 31, 2007, 2:47pm UTC](https://www.ruby-forum.com/t/script-console-questions/105591/2 "2007-05-31T14:47:10Z")

</div>

Yeah. ActiveSupport dependency checking in  
activesupport/lib/active\_support/dependencies.rb

In this case, it builds off of Module#const\_missing.

Jason

---

<div class="post-metadata">

**Author:** ![bartocc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c68b51/32.png) [@bartocc](https://www.ruby-forum.com/u/bartocc)\
**Post date:** [May 31, 2007, 2:50pm UTC](https://www.ruby-forum.com/t/script-console-questions/105591/3 "2007-05-31T14:50:11Z")

</div>

On May 31, 2007, at 2:40 PM, bartocc wrote:

> 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 ?

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
