Forum: Ruby on Rails undefined method `size' for Time:Class

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Paul Jonathan T. (Guest)
on 2007-05-15 07:33
(Received via mailing list)
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
Ben M. (Guest)
on 2007-05-15 13:39
(Received via mailing list)
Try "render :text => Time.now.to_s"

b
Paul Jonathan T. (Guest)
on 2007-05-16 01:35
(Received via mailing list)
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.
This topic is locked and can not be replied to.