0

私がこれを持っているとしましょう:

link_to "Profile", profile_path(@profile)

# => <a href="/profiles/1">Profile</a>

しかし、次のような href リンクだけが必要な場合は<a href="/profiles/1"><h1>Title</h1><p>some text</p></a>?

これを行うためのレール方法はありますか?

編集:これに対する解決策は、次のようなブロックの使用法でした:

<%= link_to(@profile) do %>
<strong><%= @profile.name %></strong> -- <span>Check it out!</span>
<% end %>
# => <a href="/profiles/1">
   <strong>David</strong> -- <span>Check it out!</span>
</a>
4

1 に答える 1

0

これが解決策でした:

<%= link_to(@profile) do %>
<strong><%= @profile.name %></strong> -- <span>Check it out!</span>
<% end %>
# => <a href="/profiles/1">
<strong>David</strong> -- <span>Check it out!</span>
</a>

それが誰かを助けることを願っています。

于 2012-01-28T17:35:16.740 に答える