Domanda

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.

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top