2

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.

1 Answer 1

7

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" %>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.