# Mixing in action view helper methods in a class

**URL:** <https://www.ruby-forum.com/t/mixing-in-action-view-helper-methods-in-a-class/104034>\
**Category:** Rails\
**Created:** [May 13, 2007, 9:01am UTC](https://www.ruby-forum.com/t/mixing-in-action-view-helper-methods-in-a-class/104034 "2007-05-13T09:01:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Myron\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Myron\_M](https://www.ruby-forum.com/u/Myron_M)\
**Post date:** [May 13, 2007, 9:01am UTC](https://www.ruby-forum.com/t/mixing-in-action-view-helper-methods-in-a-class/104034/1 "2007-05-13T09:01:58Z")

</div>

I’ve got a class where I would like to use the TextHelper truncate  
method. It’s not a M, V or C but is called by a controller. I  
figured I should be able to mixin the TextHelper in order to have  
access to the truncate method. But I can’t get it to work. I’m new  
to Ruby and ROR, so I haven’t done mixins before.

Here’s what I’ve got…

class Searcher  
require ‘action\_view/helpers/text\_helper’  
include ActionView::Helpers::TextHelper

I get a NoMethodError: undefined method `truncate’ for  
Searcher:Class. How do I get this to work?

By the way, I apologize if this has already been answered in this  
group (as is likely), but I did a search and couldn’t find it.

Thanks,  
Myron
