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?

有帮助吗?

解决方案

See documentation:

<%= link_to "back", { controller: "welcome" }, :class => "btn test" %>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top