I'm looking to convert the following from HTML to HAML.
<p class="date">
Submitted <%= time_ago_in_words(@post.created_at) %> Ago
| <%= link_to 'Edit', edit_post_path(@post) %>
My goal is the keep the Edit link on the same line like so:
Submitted about 17 hours Ago | Edit
This works however the Edit link is below the Submitted about ....string.
%p.date= "Submitted #{time_ago_in_words(@post.created_at)} Ago |"
=link_to 'Edit', edit_post_path(@post)
Outputs:
Submitted about 17 hours Ago |
Edit
This attempt outputs the Edit code as an a href string.
%p.date= "Submitted #{time_ago_in_words(@post.created_at)} Ago | #{link_to 'Edit', edit_post_path(@post)}"
Outputs:
Submitted about 17 hours Ago | <a href="/posts/3/edit">Edit</a>
Please help on achieving this.
Thanks
Aucun commentaire:
Enregistrer un commentaire