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
The call duration was <%= @call.duration.to_s %> long.
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