Question

I am trying to create a link with two classes.

Code in my view looks like this:

<%= link_to "back", controller: "welcome", :class => "btn test" %>

And am expecting to have:

<a href="/welcome/index" class="btn primary">back</a>

But am getting:

<a href="/welcome/index?class=btn+test">back</a>

What is that am doing wrong?

Était-ce utile?

La solution

See documentation:

<%= link_to "back", { controller: "welcome" }, :class => "btn test" %>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top