How do i apply a link to a td element in rails? -
i have following:
<td> <%= link_to simple_format(h(post.text)), post %> <%= time_ago_in_words(post.created_at) %> </td> in rails, how make entire td link post?
if want make of text in cell clickable, this:
<td> <%= link_to post %> <%= simple_format(h(post.text)) %> <%= time_ago_in_words(post.created_at) %> <% end %> </td> which wrap a tag around both of text bits.
if want make entire td background clickable, can't wrap td a tag since html doesn't allow a child of tr, , behavior inconsistent across browsers. rails gladly (just put td inside link_to block), wouldn't behave way want to. you'd need different markup.
Comments
Post a Comment