# Rails custom helpers

**URL:** <https://www.ruby-forum.com/t/rails-custom-helpers/187127>\
**Category:** Rails\
**Created:** [April 17, 2010, 7:24pm UTC](https://www.ruby-forum.com/t/rails-custom-helpers/187127 "2010-04-17T19:24:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [April 17, 2010, 7:24pm UTC](https://www.ruby-forum.com/t/rails-custom-helpers/187127/1 "2010-04-17T19:24:27Z")

</div>

I made a helper module and put it in the helper directory but when I  
try and access any methods it says it does not recognize them. Ideas?  
Rails 2.3.5

Helper:

module XmlTestDataHelper  
def update\_xml\_data

end

end

Controller:

update\_xml\_data

undefined local variable or method `update\_xml\_data’

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [April 17, 2010, 7:43pm UTC](https://www.ruby-forum.com/t/rails-custom-helpers/187127/2 "2010-04-17T19:43:10Z")

</div>

On Sat, Apr 17, 2010 at 2:19 PM, Me [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> end
> 
> Controller:
> 
> update\_xml\_data
> 
> undefined local variable or method `update\_xml\_data’

Are you requiring the file and including the module somewhere?

–  
Leonardo M…  
There’s no place like ~

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [April 17, 2010, 11:15pm UTC](https://www.ruby-forum.com/t/rails-custom-helpers/187127/3 "2010-04-17T23:15:00Z")

</div>

No, are not all of the helpers included all the time? I have  
‘helper :all’ in the application controller.

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [April 18, 2010, 4:33am UTC](https://www.ruby-forum.com/t/rails-custom-helpers/187127/4 "2010-04-18T04:33:21Z")

</div>

okie dokie.

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [April 18, 2010, 4:29am UTC](https://www.ruby-forum.com/t/rails-custom-helpers/187127/5 "2010-04-18T04:29:15Z")

</div>

helper: all just makes all the helpers available to your views, but  
not to controller or model classes. This is because helpers are really  
meant for views only. You can mix a helper in by including the helper,  
but it really isn’t a good practice. Better to create a separate  
module or mixin and not have it be a helper.

Sheldon Finlay
