0

我有以下html

<a href="#" data-hover="Seraglio"><span>Seraglio</span></a>

如何将其转换为 RoR ?

4

2 回答 2

0

你可以这样做: -

link_to(body, url, :data =>{:hover => your_data_hover_value})

于 2013-11-05T01:56:53.063 回答
0

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

于 2013-11-05T00:46:24.057 回答