我有以下html
<a href="#" data-hover="Seraglio"><span>Seraglio</span></a>
如何将其转换为 RoR ?
我有以下html
<a href="#" data-hover="Seraglio"><span>Seraglio</span></a>
如何将其转换为 RoR ?
你可以这样做: -
link_to(body, url, :data =>{:hover => your_data_hover_value})
Syntax:
link_to(body, url, html_options = {})
So for your example, in .erb format:
<%= link_to("#", {"data-hover" => "Seraglio"}) do %>
<span>Seraglio</span>
<% end %>
Docs: http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to