# Using a helper from the console

**URL:** <https://www.ruby-forum.com/t/using-a-helper-from-the-console/61522>\
**Category:** Rails\
**Created:** [May 24, 2006, 7:09pm UTC](https://www.ruby-forum.com/t/using-a-helper-from-the-console/61522 "2006-05-24T19:09:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![olbrich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/5f9b8f/32.png) [@olbrich](https://www.ruby-forum.com/u/olbrich)\
**Post date:** [May 24, 2006, 7:09pm UTC](https://www.ruby-forum.com/t/using-a-helper-from-the-console/61522/1 "2006-05-24T19:09:31Z")

</div>

I’ve got a couple of helper functions in my application\_helper file that  
I would like to run from the console (for debugging).

What is the correct way to invoke a helper from the console?

\_Kevin

---

<div class="post-metadata">

**Author:** ![olbrich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/5f9b8f/32.png) [@olbrich](https://www.ruby-forum.com/u/olbrich)\
**Post date:** [July 28, 2006, 3:29pm UTC](https://www.ruby-forum.com/t/using-a-helper-from-the-console/61522/2 "2006-07-28T15:29:48Z")

</div>

I’ve got a similar question - I want to run a method defined in  
ApplicationHelper on the console, but using helper.method() doesn’t  
work. Should it?

Thanks,  
Simon

On 24 May 2006 17:07:56 -0000, Kevin O.

---

<div class="post-metadata">

**Author:** ![olbrich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/5f9b8f/32.png) [@olbrich](https://www.ruby-forum.com/u/olbrich)\
**Post date:** [July 28, 2006, 3:34pm UTC](https://www.ruby-forum.com/t/using-a-helper-from-the-console/61522/3 "2006-07-28T15:34:35Z")

</div>

load ‘application\_helper.rb’

and then just call the functions in the module.

If you make changes to the file, just retype the line.

Cheers  
Nic

---

<div class="post-metadata">

**Author:** ![olbrich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/5f9b8f/32.png) [@olbrich](https://www.ruby-forum.com/u/olbrich)\
**Post date:** [July 28, 2006, 3:40pm UTC](https://www.ruby-forum.com/t/using-a-helper-from-the-console/61522/4 "2006-07-28T15:40:55Z")

</div>

normally, you cannot run helpers or controllers through rails console;  
however, you can add this by editing the console script and added the  
following line:  
require File.dirname( **FILE** ) + “/…/config/environment.rb”  
after the line that requires boot.rb

I found this out from  
[http://rails.techno-weenie.net/question/2006/7/19/importing-local-files-through-file\_column-w-backgroundrb](http://rails.techno-weenie.net/question/2006/7/19/importing-local-files-through-file_column-w-backgroundrb)

The link is about backgroundrb, but the premise is the same.

Jason
