Ruby on Rails Thursday, February 23, 2017
On Thu, Feb 23, 2017 at 9:28 AM mike r <firstname.lastname@example.org> wrote:
hello all, Im developing a ruby script (ruby 1.8.7)its a simple script to generate an email using an ERBmy ERB has thisJIRA ticket:[ <%= issue_key %> ] - <%= summary %>where issue_key is this, https://jira-server.com/api/rest/query/ABC-123I 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 stringsimilar 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 email@example.com.
To post to this group, send email to firstname.lastname@example.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAHUC_t-3UETMdp%3DrvWvvz22%3DJGwS-x1UGSuuJjpD4OYAymqJ1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Posted by Ruby on Rails at 9:05 PM