[Rails] RE: How to highlight the search term in the search result

Bharat Ahluwalia bharata at aditi.com
Wed Jul 26 18:45:30 GMT 2006


From: "Neeraj Kumar" <neeraj.jsr at gmail.com>
> Subject: [Rails] How to highlight the search term in the search result
> To: rails at lists.rubyonrails.org
> Message-ID:
> 	<a60b4e990607260542s3ef7ad5el4cc19a5f7d01115c at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> In the 'basecamp' product from 37signals if I search for 
> 'ruby' the I get a
> bunch of results. In the search result page the search term 
> (ruby in this
> case) is highlighted.
> 
> I was wondering how to accomplish the same.
> 
> How to highlight the 'search term' in the search result? Is there any
> already existing utility that I could use?
> 
> Thanks.

Use the "highlight" command in the rhtml file 
Take a look at page #11 in the beta book at
http://media.pragprog.com/titles/rails/Chapter18.pdf
for an example. 

Bharat
http://blog.publishedperspectives.com



More information about the Rails mailing list