hELLO...I AM IN DOUBT WITH THIS,....
THANKS


TypeError in Classified#show
Showing app/views/classified/show.rhtml where line #17 raised:

no implicit conversion to float from nil

Extracted source (around line #17):

14:
15: <strong>Date Posted:</strong> <%=
distance_of_time_in_words_to_now(@classified.created_at) %> ago <br />
16:
17: <strong>Last updated:</strong> <%=
distance_of_time_in_words(@classified.updated_at, Time.now) %> ago </p>
18: <p><%= @classified.description %></p>
19:
20: <hr/>



RAILS_ROOT: ./script/../config/..

Application Trace | Framework Trace | Full Trace

#{RAILS_ROOT}/app/views/classified/show.rhtml:17:in



Request
Parameters: {"id"=>"16"}

Show session dump

---
flash: !map:ActionController::Flash::FlashHash {}


Response
Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"}

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Colin Law at Nov 2, 2011 at 9:46 pm

    On 2 November 2011 21:35, Rolando Sotomayor wrote:
    hELLO...I AM IN DOUBT WITH THIS,....
    THANKS


    TypeError in Classified#show
    Showing app/views/classified/show.rhtml where line #17 raised:

    no implicit conversion to float from nil

    Extracted source (around line #17):

    14:
    15:     <strong>Date Posted:</strong> <%=
    distance_of_time_in_words_to_now(@classified.created_at) %> ago <br />
    16:
    17:     <strong>Last updated:</strong> <%=
    distance_of_time_in_words(@classified.updated_at, Time.now) %> ago </p>
    Well you obviously got past the previous problem with method not
    found. I hope you are going to tell us what the problem was. It may
    well be relevant to this problem. RoR error messages are often not
    that clear but often it is possible to work out what is the problem.
    The error says that you cannot convert from nil to a float. That says
    that something is nil. Looking at the line of code it seems unlikely
    that it is Time.now that is nil so the most likely thing is
    @classified.updated_at. That would suggest that you have a record in
    the db which has not got a value in the updated_at column.

    Colin
    18:     <p><%= @classified.description %></p>
    19:
    20:     <hr/>



    RAILS_ROOT: ./script/../config/..

    Application Trace | Framework Trace | Full Trace

    #{RAILS_ROOT}/app/views/classified/show.rhtml:17:in



    Request
    Parameters: {"id"=>"16"}

    Show session dump

    ---
    flash: !map:ActionController::Flash::FlashHash {}


    Response
    Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"}

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.


    --
    gplus.to/clanlaw

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Rolando Sotomayor at Nov 3, 2011 at 1:02 pm
    Well this time is another error...
    you are right...I check the DB and realize that the field updated_at it
    doesn't take any value itself, once I edit an item on my application.
    I've edited some items but no items took value at that field, but one
    item, ramdonly(I guess),This item is the only one I can show, because
    is the unique that take value at this field into the DB...so the others
    records don't take value, that's why I got that error message
    no implicit conversion to float from nil
    when I tried to show them.

    Why just one record is updated when I edited it...why the others don't?
    Is there any problem with my DB or with the application?
    Thanks

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Colin Law at Nov 3, 2011 at 1:33 pm

    On 3 November 2011 13:01, Rolando Sotomayor wrote:
    Well this time is another error...
    you are right...I check the DB and realize that the field updated_at it
    doesn't take any value itself, once I edit an item on my application.
    I've edited some items but no items took value at that field, but one
    item, ramdonly(I guess),This item is  the only one I can show, because
    is the unique that take value at this field into the DB...so the others
    records don't take value, that's why I got that error message
    no implicit conversion to float from nil
    when I tried to show them.

    Why just one record is updated when I edited it...why the others don't?
    Is there any problem with my DB or with the application?
    I am not sure what you did to fix the previous problem. Did the field
    not exist so then you added it? If so then records that were in the
    db before you added the field will not have a created_at entry, but
    any new ones since then will have the date. I can assure you that
    there is a good reason for some having the date and others not, it is
    not random, though it may not be clear what the reason is.

    For the moment, to stop your view crashing, you could change the code
    to something like
    <%= distance_of_time_in_words_to_now(@classified.created_at) if
    @classified.created_at %>

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Rolando Sotomayor at Nov 3, 2011 at 2:04 pm
    I have solved the problem with you have done to me....
    thanks...

    In had created the DB with all the fields I would use...I didnt add or
    drop any of them...but I dont know why...the field update_at doesnt
    update...and created_at yes. create_at took value but not updated_at

    when I create an item I can upload a picture or not of that item...if I
    upload it them updted_at is updated.

    Another thing..for instance..I have create an item X.
    If i want when I edit it if if I replaced the name by Y por
    instance....and save the changes...the DB dont save the updated date at
    the field uopdate_at...otherwise if I change the photo/picture or i
    replaced the existing one then updated_at took value...a little odd for
    me.

    Anyway the fact is that I have solve what you suggest me..
    Thanks again.

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedNov 2, '11 at 9:35p
activeNov 3, '11 at 2:04p
posts5
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Rolando Sotomayor: 3 posts Colin Law: 2 posts

People

Translate

site design / logo © 2022 Grokbase