# App/helpers in Rails

**URL:** <https://www.ruby-forum.com/t/app-helpers-in-rails/179564>\
**Category:** Ruby\
**Created:** [November 28, 2009, 6:30pm UTC](https://www.ruby-forum.com/t/app-helpers-in-rails/179564 "2009-11-28T18:30:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![T\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/41988e/32.png) [@T\_P](https://www.ruby-forum.com/u/T_P)\
**Post date:** [November 28, 2009, 6:30pm UTC](https://www.ruby-forum.com/t/app-helpers-in-rails/179564/1 "2009-11-28T18:30:27Z")

</div>

Hello!

I am new to ruby (and to ruby on rails). Having created some helpers  
with  
script/generate helper HelperName

how do I access them in controllers and views? :-/

Tuo Pe

---

<div class="post-metadata">

**Author:** ![T\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/41988e/32.png) [@T\_P](https://www.ruby-forum.com/u/T_P)\
**Post date:** [November 28, 2009, 6:49pm UTC](https://www.ruby-forum.com/t/app-helpers-in-rails/179564/2 "2009-11-28T18:49:11Z")

</div>

On Saturday 28 November 2009 11:30:06 am T\_P wrote:

> Having created some helpers  
> with  
> script/generate helper HelperName
> 
> how do I access them in controllers and views? :-/

Probably, include them into the controller you need, or into  
ApplicationController to make them available everywhere.

But I don’t know, haven’t touched Rails in awhile. Ask the Rails list.

---

<div class="post-metadata">

**Author:** ![T\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/41988e/32.png) [@T\_P](https://www.ruby-forum.com/u/T_P)\
**Post date:** [November 29, 2009, 11:26am UTC](https://www.ruby-forum.com/t/app-helpers-in-rails/179564/3 "2009-11-29T11:26:58Z")

</div>

You can specify “helper :all” in ApplicationController.rb, which will  
make  
all helpers available to all controllers and views.

[http://api.rubyonrails.org/classes/ActionController/Helpers/ClassMethods.html#M000490](http://api.rubyonrails.org/classes/ActionController/Helpers/ClassMethods.html#M000490)

-Evan

---

<div class="post-metadata">

**Author:** ![T\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/41988e/32.png) [@T\_P](https://www.ruby-forum.com/u/T_P)\
**Post date:** [November 29, 2009, 11:53am UTC](https://www.ruby-forum.com/t/app-helpers-in-rails/179564/4 "2009-11-29T11:53:47Z")

</div>

T\_P wrote:

> how do I access them in controllers and views? :-/

They are available in views already.

For a method to be available both in controllers and views, define it as  
a method in the ApplicationController instead:

private  
def my\_helper(foo)  
return “#{foo}!!”  
end  
helper\_method :my\_helper
