KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
With rails version 2.3.8 I'm trying to get HTML output like: <a href="/product/list" data-role="button">Product list</a> So an A tag with a custom attribute "data-role". (The reason I want the "data-role" attribute is that I'm working with JQuery Mobile which picks up on this attribute and does its magic) So I was trying to do this <%= link_to "product list", :controller => "product", :action => "list", "data-role" => "button" %> Judging by this tutorial perhaps this would work in rails 3, but in rails 2.3.8 it interprets it by generating a data-role=button parameter on the link URL. One way I can get the desired HTML output is to use url_for instead: <a href="<%=url_for :controller =>"product", :action => "list" %>" data-role="button">Product list</a> A bit long and ugly. Is there a way to make link_to output custom attributes in the A tag (?)
Tags (comma-separated)
Save Edits
Cancel