Domanda

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?

È stato utile?

Soluzione

See documentation:

<%= link_to "back", { controller: "welcome" }, :class => "btn test" %>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top