Good Evening all!!
I am writing a blog into my app at the moment and have got it so that users can comment on a post.
THe comments render perfectly, so to enhance the experience, I wanted to add a note to show users how long ago a post was added.
Here's what I have...
<h5>Comments</h5>
<% for blogcomment in @blogpost.blogcomments %> <%= blogcomment.body %>
<hr />
<% end %>
<%= form_tag :action => "comment", :id => @blogpost %> <%= text_area "comment", "body", :cols => 20, :rows => 6 %><br /> <%= submit_tag "Comment" %>
This shows the comment, but when I add the following I get an error: (no implicit conversion to float from nil)
(posted on <%= time_ago_in_words(blogcomment.created_at) %>)
I know the table name is correct because the follwing did render the date:
(posted on <%= blogcomment.created_at %>)
Ideally I'd like it shown in words instead of a dd/mm/yyyy format.
ANy suggestions??
Thanks