Undefined method `size' for Time:Class


#1

Hi

I am running rails 1.2.3 and am getting - NoMethodError in
Chapter3Controller#get_time

undefined method `size’ for Time:Class

RAILS_ROOT: script/…/config/… -

I do this in my controller -CODE-

def get_time
sleep 1.second
render :text => Time
end

If I do this -CODE_

def get_time
sleep 1.second
render :text => Time.now
end

I am getting this message: NoMethodError in Chapter3Controller#get_time

undefined method `size’ for Tue May 15 15:29:22 +1200 2007:Time

RAILS_ROOT: script/…/config/…

There appears to be a problem in the Time class. Can anyone help?

Thanks,

Paul Thompson


#2

Try “render :text => Time.now.to_s”

b


#3

Thanx Ben, that worked. Funny though, I am working through the AJAX on
Rails book and it is not shown like that in any of there examples.