How do I wrap link_to around some html ruby code?

link_to takes a block of code ( >= Rails 2.2) which it will use as the body of the tag.

So, you do

<%= link_to(@album) do %>
  html-code-here
<% end %>

But I’m quite sure that to nest a div inside a a tag is not valid HTML.

EDIT: Added = character per Amin Ariana’s comment below.

Leave a Comment