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

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -