Frage

I'm building a small static website using Ruby and Middleman. With Rails I've been able to safely encode email links with the mail_to helper and the encode: 'hex' option;

mail_to 'email@email.com', 'My Name', encode: 'hex'

But when I try this in Middleman using the same code I wind up with this in my HTML;

<a encode="hex" href="mailto:email@email.com">My Name</a>

Any suggestions? I tried adding actionpack to my gemfile, but that didn't help.

War es hilfreich?

Lösung

Although both helpers from Middleman and Rails are called the same, they are actually not the same in code. Moreover, encode parameter has been removed from Rails 4 and you now have to require a separate gem to use it.

I think, your best option will be to look at the code in that gem and reimplement it as a separate helper for your Middleman project.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top