How to refactor the following Rails erb code? -
i need refactor code using link_to method.
<a href="post.html"> <h2 class="post-title"> <%= post.title %> </h2> <h3 class="post-subtitle"> <%= post.subheading %> </h3> </a>
i want this:
<%= link_to ".........",post) %>
the "......" refactored code.
you need pass block link_to
:
<%= link_to post_url(@post) %> <h2 class="post-title"> <%= post.title %> </h2> <h3 class="post-subtitle"> <%= post.subheading %> </h3> <% end %>
Comments
Post a Comment