Forum: Ruby on Rails ruport - how to wrap <a href=" "> tags around text inside a ruport table

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Steve J. (Guest)
on 2009-01-13 11:29
(Received via mailing list)
Anyone know how to embed a hyperlink in a ruport table?  The url is in
mysql. I'm using,after much head-banging, report_table_by_sql to build
a ruport table, which of course, also now contains the url text.   I
want to diplay each url as a hyperlink in the browser. I'm lazy an
would like to use a ruby/rails/ruport function of some sort to parse
this url and rewrite it as hyperlink (<a href=" ...url">derivce text
from url</a>) as part of ruport.

Here's an example:

This controller code generates a table:

   #note : @low = 70 and @high = 100 thanks to params from a form....
   #note "link" refers to WAN circuits and not hyperlinks...

   @links = Link.report_table_by_sql [ "SELECT headend, out_90th_util,
bandwidth, hyperlink
        FROM (SELECT * FROM (SELECT * FROM links ORDER BY link_key
DESC, out_90th_util DESC) t
          GROUP BY link_key)t2
          WHERE out_90th_util > ? AND out_90th_util < ? ", @low,
@high ]

Here is the corresponding view code that generates simple table in a

<h3>Table Using Ruport</h3>
<%= @links.to_html %>

Here is a sample from the browser:

out_90th_util    hyperlink    bandwidth    headend
3000000   arouter99

I need to subsitute something like this inside the report for the
<a href="

I have not yet tinkered with ruport or rails enough to have much of
clue.  I'm hoping to get this working so I don't revert back to perl.
I must admit perl is looking pretty attractive at this point ;-)... I
could try to wrap the http:// in tags inside mysql.  But I would like
to know if it can be done in ruport (if I don't have control of the
database table).

Thanks to anyone who bothered to read this far!
This topic is locked and can not be replied to.