Question

I use rails and jquery mobile for my site. To create a button styled link, I have to do add specific info, like this:

<a href="user/login" data-role="button" data-theme="a">login</a>

To do this in Rails, I should use the link_to like this:

<%= link_to 'Login', :controller => "user", :action => "login", "data-icon" => "button", "data-theme" => "a" %>

But this is not working, it shows as a normal link. When I look in the code it looks like this:

<a href="/user/login?data-icon=button&amp;data-theme=a" class="ui-link">Login</a>

Any ideas why this happens? Thanks!

Was it helpful?

Solution

Try

<%= link_to 'Login', {:controller => "user", :action => "login"}, {"data-icon" => "button", "data-theme" => "a"} %>

The reason this is different is explained here: http://apidock.com/rails/v3.0.0/ActionView/Helpers/UrlHelper/link_to

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top