# Trying to write a lite Rails version of Yahoo Shortcuts or something similiar

**URL:** <https://www.ruby-forum.com/t/trying-to-write-a-lite-rails-version-of-yahoo-shortcuts-or-something-similiar/143167>\
**Category:** Rails\
**Created:** [July 15, 2008, 10:15pm UTC](https://www.ruby-forum.com/t/trying-to-write-a-lite-rails-version-of-yahoo-shortcuts-or-something-similiar/143167 "2008-07-15T22:15:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![walksalong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/4491bb/32.png) [@walksalong](https://www.ruby-forum.com/u/walksalong)\
**Post date:** [July 15, 2008, 10:15pm UTC](https://www.ruby-forum.com/t/trying-to-write-a-lite-rails-version-of-yahoo-shortcuts-or-something-similiar/143167/1 "2008-07-15T22:15:57Z")

</div>

Has anyone ever seen Yahoo Shortcuts or something similiar? I would  
like to write my own in Rails, but I’m not sure the best approach…  
or is there something already out there that I’ve missed?

The story goes I have a list of site specific keywords I would like to  
compare my other site content with. As the page loads the content I  
would like to do a comparison- basically parse over the text and if  
there is a match with a keyword then I can create a connection and  
link.

Right now, I am using Hpricot along with Prototip.js. I’ve been  
manually wrapping keywords using a span tag along with attributes  
within the data to test:

\<% doc = Hpricot("#{e.description}") %\>  
\<% (doc/"//span").each do |span| %\>  
\<% set\_record\_type = span.attributes[“record\_type”] rescue nil %\>

#\<%= span.attributes["id"] %\>{ font-size: 12px; color: dodgerblue; }

\<% end %\>

If I hit a match I underline the term then I drop in some Prototip  
code to load up a show in my controller.

I’m wondering if there is a better approach. I thought about putting  
the keywords in an XML file and parsing through that instead to  
improve performance, but I’m not quite sure how to cache XML in Rails  
or if that would be helpful.

Thanks
