# Script/console doesn't load model

**URL:** <https://www.ruby-forum.com/t/script-console-doesnt-load-model/86052>\
**Category:** Rails\
**Created:** [February 19, 2007, 1:51pm UTC](https://www.ruby-forum.com/t/script-console-doesnt-load-model/86052 "2007-02-19T13:51:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![antonaylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@antonaylward](https://www.ruby-forum.com/u/antonaylward)\
**Post date:** [February 19, 2007, 1:51pm UTC](https://www.ruby-forum.com/t/script-console-doesnt-load-model/86052/1 "2007-02-19T13:51:41Z")

</div>

I’m trying to test functions in my models using the console.

Should the code be in the model? I think so.  
I’m encapsulating  
find( … :conditions=\> …

However these functions aren’t available when I run the console.

Am I missing something or is this ‘by design’?

–  
life, n.:  
A whim of several billion cells to be you for a while.

---

<div class="post-metadata">

**Author:** ![antonaylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@antonaylward](https://www.ruby-forum.com/u/antonaylward)\
**Post date:** [February 19, 2007, 7:07pm UTC](https://www.ruby-forum.com/t/script-console-doesnt-load-model/86052/2 "2007-02-19T19:07:27Z")

</div>

Hi, you should be invoking the find method as follows:

class\_name.method\_name

e.g. Product.find( :all )

Good luck,

-Conrad

---

<div class="post-metadata">

**Author:** ![antonaylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@antonaylward](https://www.ruby-forum.com/u/antonaylward)\
**Post date:** [February 19, 2007, 10:22pm UTC](https://www.ruby-forum.com/t/script-console-doesnt-load-model/86052/3 "2007-02-19T22:22:56Z")

</div>

Conrad T. said the following on 02/19/2007 01:06 PM:

> Hi, you should be invoking the find method as follows:
> 
> class\_name.method\_name

That _IS_ what I was typing.

In fact the console has a this neat trick whereby if you type the name  
of  
the class and a tab it will show the methods, or class\_name.find  
and it  
will show you all the find methods for that class.

I do this I I don’t see the methods I have defined in the model.

a = Page.find\_in

and I don’t see the “find\_in\_book” that I defined in the model.

–  
Clear the battlefield and let me see  
All the profit from our victory.  
You talk of freedom, starving children poor.  
Are you deaf when you hear the season’s call?  
Were you there to watch the earth be scorched?  
Did you stand beside the spectral torch?  
Know the leaves of sorrow turned their face,  
Scattered on the ashes of disgrace.

---

<div class="post-metadata">

**Author:** ![antonaylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@antonaylward](https://www.ruby-forum.com/u/antonaylward)\
**Post date:** [February 20, 2007, 1:03am UTC](https://www.ruby-forum.com/t/script-console-doesnt-load-model/86052/4 "2007-02-20T01:03:16Z")

</div>

Did you restart ./script/console ?

---

<div class="post-metadata">

**Author:** ![antonaylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@antonaylward](https://www.ruby-forum.com/u/antonaylward)\
**Post date:** [February 20, 2007, 1:21am UTC](https://www.ruby-forum.com/t/script-console-doesnt-load-model/86052/5 "2007-02-20T01:21:18Z")

</div>

Yes.

Ved Bew said the following on 02/19/2007 07:02 PM:

> > the class and a tab it will show the methods, or class\_name.find and it  
> > will show you all the find methods for that class.
> > 
> > I do this I I don’t see the methods I have defined in the model.
> > 
> > a = Page.find\_in
> > 
> > and I don’t see the “find\_in\_book” that I defined in the model.

–  
“How well we communicate is determined not by how well we say things but  
by  
how well we are understood.”  
– Andrew S. Grove.
