Do I need to define @duration somewhere? I want to calculate the
duration of a call in the model and then for the view to display that
calculation.
Right now, the view, show.rhtml for calls, is giving an "You have a nil
object when you didn''t expect it!" error :(
thufir@arrakis ~/goodfellow-tool $
thufir@arrakis ~/goodfellow-tool $ cat app/views/calls/show.rhtml -n |
head -n 9 | tail -n 1
9 <p> The call duration was <%= @call.duration.to_s %> long.
</p>
thufir@arrakis ~/goodfellow-tool $
thufir@arrakis ~/goodfellow-tool $ cat app/models/call.rb
class Call < ActiveRecord::Base
def duration
return (@end - @start).to_time
end
end
thufir@arrakis ~/goodfellow-tool $
the trunk where the code is at:
http://code.google.com/p/goodfellow-tool/source/browse
thanks,
Thufir
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---