# A question about accessing a controller's helper

**URL:** <https://www.ruby-forum.com/t/a-question-about-accessing-a-controllers-helper/118955>\
**Category:** Rails\
**Created:** [November 1, 2007, 6:06pm UTC](https://www.ruby-forum.com/t/a-question-about-accessing-a-controllers-helper/118955 "2007-11-01T18:06:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![awhayes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@awhayes](https://www.ruby-forum.com/u/awhayes)\
**Post date:** [November 1, 2007, 6:06pm UTC](https://www.ruby-forum.com/t/a-question-about-accessing-a-controllers-helper/118955/1 "2007-11-01T18:06:56Z")

</div>

When I set up my controllers, I put some of them in a sub-directory  
under app/controllers. That works fine. My problem is that the  
helpers are also placed in a sub-directory of the same name. I can’t  
seem to figure out how to access the helper belonging to one of the  
controllers in the sub-directory. For example, the directory  
hierarchy looks like this.

./app/controllers  
./app/controllers/foo  
./app/controllers/foo/my\_controller.rb  
./app/helpers  
./app/helpers/foo  
./app/helpers/foo/my\_controller\_helper.rb

How can I set up an include (I assume) so the controller can find its  
helper? Or do I have to move the helper methods into a shared higher-  
level helper?

Thanks.

---

<div class="post-metadata">

**Author:** ![awhayes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@awhayes](https://www.ruby-forum.com/u/awhayes)\
**Post date:** [November 1, 2007, 6:33pm UTC](https://www.ruby-forum.com/t/a-question-about-accessing-a-controllers-helper/118955/2 "2007-11-01T18:33:51Z")

</div>

On 1 Nov 2007, at 15:07, awhayes wrote:

> level helper?  
> IIRC for this to work, my\_controller\_helper.rb should define module  
> Foo::MyControllerHelper

Fred

---

<div class="post-metadata">

**Author:** ![awhayes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@awhayes](https://www.ruby-forum.com/u/awhayes)\
**Post date:** [November 1, 2007, 8:02pm UTC](https://www.ruby-forum.com/t/a-question-about-accessing-a-controllers-helper/118955/3 "2007-11-01T20:02:49Z")

</div>

Thanks, Fred. After I posted the question, I tried ‘include  
Foo::MyControllerHelper’ and it seemed to work fine.

On Nov 1, 11:27 am, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
