On 2/25/08, Sukeerthi Adiga <sukeerthiadiga / gmail.com> wrote:
> 7stud -- wrote:
>  > Sukeerthi Adiga wrote:
>  >> Loading development environment.
>  >>>> Time.now.to_date
>  >> Time.now.to_date
>  >> NoMethodError: private method `to_date' called for Mon Feb 25 12:04:10
>  >> +0530 2008:Time
>  >>   from (irb):1
>  >>>>
>  >>
>  >> earlier it use to work fine..
>  >> can any one help me whats the prob is?
>  >>
>  >> in terminal it shows like this..
>  >>
>  >> sukeerthi@sukeerthi-desktop:~$ ruby -v
>  >> ruby 1.8.6 (2007-06-07 patchlevel 36) [x86_64-linux]
>  >> sukeerthi@sukeerthi-desktop:~$
>  >
>  > $ ruby -v
>  > ruby 1.8.6 (2007-03-13 patchlevel 0) [universal-darwin8.0]
>  >
>  >
>  > puts Time.now.to_date
>  >

> so where should i make change so that it should work..
>  in most of the functions i have written

Ruby is not Rails!

The problem is that Time#to_date is an extension which Rails makes to
Ruby.  That's why it's working for folks who are running this code
under script/console in a Rails project but doesn't work if you run it
under Ruby w/o rails.

In order to use the activesupport extensions you need to:

    require 'rubygems'
    require 'activesupport'

-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/