# How can I force require a file in the console?

**URL:** <https://www.ruby-forum.com/t/how-can-i-force-require-a-file-in-the-console/192195>\
**Category:** Rails\
**Created:** [July 26, 2010, 4:45am UTC](https://www.ruby-forum.com/t/how-can-i-force-require-a-file-in-the-console/192195 "2010-07-26T04:45:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ctwise](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@ctwise](https://www.ruby-forum.com/u/ctwise)\
**Post date:** [July 26, 2010, 4:45am UTC](https://www.ruby-forum.com/t/how-can-i-force-require-a-file-in-the-console/192195/1 "2010-07-26T04:45:40Z")

</div>

I use rails-3.0.0.beta3 and ruby-1.9.2-preview3.

I have defined some new methods in the application\_controller.rb, and  
need to test them in the consle.

If I changed some codes in the application\_controller.rb.  
I should always restart the console.

I have tried to use ‘reload!’ command, just dosen’t work.

And then I use “require ‘applicatioin.rb’”,  
still dosen’t work.

Help! ☹

---

<div class="post-metadata">

**Author:** ![ctwise](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@ctwise](https://www.ruby-forum.com/u/ctwise)\
**Post date:** [July 26, 2010, 6:16pm UTC](https://www.ruby-forum.com/t/how-can-i-force-require-a-file-in-the-console/192195/2 "2010-07-26T18:16:27Z")

</div>

Well Application Controller is a class, so I think you would want to  
do require “ApplicationController”

If that does not work you can always just paste the methods in and  
call them. Kind of hacky but it works.

---

<div class="post-metadata">

**Author:** ![ctwise](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@ctwise](https://www.ruby-forum.com/u/ctwise)\
**Post date:** [July 27, 2010, 7:51pm UTC](https://www.ruby-forum.com/t/how-can-i-force-require-a-file-in-the-console/192195/3 "2010-07-27T19:51:56Z")

</div>

Charles Wang wrote:

> I use rails-3.0.0.beta3 and ruby-1.9.2-preview3.
> 
> I have defined some new methods in the application\_controller.rb, and  
> need to test them in the consle.
> 
> If I changed some codes in the application\_controller.rb.  
> I should always restart the console.
> 
> I have tried to use ‘reload!’ command, just dosen’t work.
> 
> And then I use “require ‘applicatioin.rb’”,  
> still dosen’t work.
> 
> Help! ☹

How are you trying to run your controller methods in the console?  
What’s the exact syntax you’re using? Normally, you can’t do this  
easily…

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
