philip
philip

Reputation: 206

Add CSS class to mail_to ruby on rails helper

I know that you can add HTML classes to link_to helpers like this:

<%= link_to 'Logout', logout_path, class: 'primary-link-style' %>

But what about the mail_to helper? There doesn't seem to be a way to add a HTML/CSS class like you can with the link_to helper.

The docs only talk about examples of inline styling which I want to avoid.

Upvotes: 2

Views: 2228

Answers (1)

Jordan Running
Jordan Running

Reputation: 106027

The method signature from the docs you linked to:

mail_to(email_address, name = nil, html_options = {}, &block)

That third argument, html_options, works just like the same argument of link_to:

<%= mail_to "[email protected]", "Email me", class: "primary-link-style" %>

Upvotes: 7

Related Questions