# TypeError in highlight (ActionView::Helpers::TextHelper)

**URL:** <https://www.ruby-forum.com/t/typeerror-in-highlight-actionview-texthelper/129327>\
**Category:** Rails\
**Created:** [February 16, 2008, 8:21pm UTC](https://www.ruby-forum.com/t/typeerror-in-highlight-actionview-texthelper/129327 "2008-02-16T20:21:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pahagon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ac8455/32.png) [@pahagon](https://www.ruby-forum.com/u/pahagon)\
**Post date:** [February 16, 2008, 8:21pm UTC](https://www.ruby-forum.com/t/typeerror-in-highlight-actionview-texthelper/129327/1 "2008-02-16T20:21:09Z")

</div>

I was trying to highlight more than 1 term in a text with highlight  
method from TextHelper. Much to my surprise, I just copied the example  
from Rdoc ([http://api.rubyonrails.org/classes/ActionView/Helpers/](http://api.rubyonrails.org/classes/ActionView/Helpers/)  
TextHelper.html#M001050): highlight(‘You searched for: rails’,  
[‘for’, ‘rails’], ‘_\1_’)

But I get TypeError.

C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action\_view/  
helpers/text\_helper.rb:48:in `escape' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_view/ helpers/text_helper.rb:48:in `highlight’

Then I updated to Rails 2.0.2 (gem update rails -y ). But still  
doesn’t work. On the two lines above, the path  
is …actionpack-1.13.6 … what do I need to do to work with  
actionpack 2.0.2?

I’m working with netbeans for win XP

Thanks in advance,

Paulo P.

---

<div class="post-metadata">

**Author:** ![pahagon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ac8455/32.png) [@pahagon](https://www.ruby-forum.com/u/pahagon)\
**Post date:** [February 18, 2008, 12:50pm UTC](https://www.ruby-forum.com/t/typeerror-in-highlight-actionview-texthelper/129327/2 "2008-02-18T12:50:02Z")

</div>

On 16 Feb 2008, at 19:20, Paulo P. wrote:

> helpers/text\_helper.rb:48:in `escape' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_view/ helpers/text_helper.rb:48:in`highlight’
> 
> Then I updated to Rails 2.0.2 (gem update rails -y ). But still  
> doesn’t work. On the two lines above, the path  
> is …actionpack-1.13.6 … what do I need to do to work with  
> actionpack 2.0.2?

You’re environment.rb probably says something like  
RAILS\_GEM\_VERSION = ‘1.2.5’ unless defined? RAILS\_GEM\_VERSION

Change that to the version of rails you want to use. Don’t forget to  
run rake rails:update

Fred
