Ruby on Rails Thursday, February 23, 2017

On Thu, Feb 23, 2017 at 9:28 AM mike r <> wrote:
hello all, Im developing a ruby script (ruby 1.8.7)

its a simple script to generate an email using an ERB

my ERB has this 

JIRA ticket:
[ <%= issue_key %> ] - <%= summary %> 

I was wondering if its possible to embed that hyperlink somehow the ERB. When I get the email from this script, it embeds everything as plain text, I cant find a way to embed a hyperlink into a string

similar to this, 

<a href="https://jira-server/etc"> [ ABC-123 ] </a>

If you want the link text to be the last bit of the issue_key, you can get that by using the built-in File.basename method, and make this your content:

<a href="<%= issue_key %>">[ <%= File.basename(issue_key) %> ]</a>

Note that this is an off-label use of File.basename, but it works since URL paths look just like file paths. I have no recollection of the libraries available in 1.8.7 which has been obsolete for years now, but File.basename was there.


You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment