no implicit conversion to float from nil

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

sounds like there is at least one of your blog comments for which created_at is nil

Fred

Ah yes - i cleared the tables, started again and the problem has gone!! :slight_smile:

Thanks for that Frederick!