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…

Comments

<% for blogcomment in @blogpost.blogcomments %>
<%= blogcomment.body %>

  <hr />

<% end %>

<%= form_tag :action => “comment”, :id => @blogpost %>
<%= text_area “comment”, “body”, :cols => 20, :rows => 6 %>

<%= 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

On Jul 5, 8:41 pm, RubyonRails_newbie [email protected] wrote:

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:

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!