0
讓我們說我有這樣的:如何顯示其中的html標籤鏈接html代碼?
link_to "Profile", profile_path(@profile)
# => <a href="/profiles/1">Profile</a>
但如果我只需要像<a href="/profiles/1"><h1>Title</h1><p>some text</p></a>
的HREF鏈接?
有沒有這樣做的軌道方法?
編輯:Soluction因爲這是塊使用這樣的:
<%= 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>
link_to「」,profile_path(@profile)也許? –
對不起,我不得不編輯,以確切地問我在找什麼。 –
剛剛發現有關使用塊的文檔。謝謝! –