开发者

link_to not formatting button

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!


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜