PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > NoMethodError: private method `to_date'
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
NoMethodError: private method `to_date'

Réponse
 
LinkBack Outils de la discussion
Vieux 25/02/2008, 06h38   #1
Sukeerthi Adiga
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut NoMethodError: private method `to_date'

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 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:~$
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 25/02/2008, 07h03   #2
7stud --
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: NoMethodError: private method `to_date'

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 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

--output:--
undefined method `to_date' for Sun Feb 24 23:59:42 -0700 2008:Time
(NoMethodError)


And, pickaxe2 lists no method in the Time class called to_date.
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 25/02/2008, 07h11   #3
Shiva Kumaran
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: NoMethodError: private method `to_date'

just try in console mode :/ruby script/console
it will work


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 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:~$


--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 25/02/2008, 07h16   #4
Sukeerthi Adiga
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: NoMethodError: private method `to_date'

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 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


> --output:--
> undefined method `to_date' for Sun Feb 24 23:59:42 -0700 2008:Time
> (NoMethodError)
>
>
> And, pickaxe2 lists no method in the Time class called to_date.


--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 25/02/2008, 07h18   #5
Sukeerthi Adiga
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: NoMethodError: private method `to_date'

Shiva Kumaran wrote:
> just try in console mode :/ruby script/console
> it will work
>
>
> 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 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:~$


tried no use same error m gettin


sukeerthi@sukeerthi-desktop:/home/workspace/St$ ruby script/console
Loading development environment.
oldcolname==old2 ,newcolname==new2
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in
`const_missing':NameError: uninitialized constant Test
>> time.now.to_date

NameError: undefined local variable or method `time' for
#<Object:0x2b536c4b8350>
from (irb):1
>> Time.now.to_date

NoMethodError: private method `to_date' called for Mon Feb 25 12:45:18
+0530 2008:Time
from (irb):2
>>

--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 25/02/2008, 07h46   #6
Deepa Shirur
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: NoMethodError: private method `to_date'

Sukeerthi Adiga wrote:
> Shiva Kumaran wrote:
>> just try in console mode :/ruby script/console
>> it will work
>>
>>
>> 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 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:~$

>
> tried no use same error m gettin
>
>
> sukeerthi@sukeerthi-desktop:/home/workspace/St$ ruby script/console
> Loading development environment.
> oldcolname==old2 ,newcolname==new2
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in
> `const_missing':NameError: uninitialized constant Test
>>> time.now.to_date

> NameError: undefined local variable or method `time' for
> #<Object:0x2b536c4b8350>
> from (irb):1
>>> Time.now.to_date

> NoMethodError: private method `to_date' called for Mon Feb 25 12:45:18
> +0530 2008:Time
> from (irb):2
>>>


Hi Sukeerthi, Better u change your rails version, Mine is rails 1.2.3,
The problem what you have sent its working fine.

deepac@deepa-UBUNTU-7:~/workspace/srishti$ script/console
Loading development environment.
>> Time.now

=> Mon Feb 25 13:03:46 +0530 2008
>> a = Time.now

=> Mon Feb 25 13:04:07 +0530 2008
>> a.to_date

=> #<Date: 4909043/2,0,2299161>
>> Time.now.to_date

=> #<Date: 4909043/2,0,2299161>
:0)
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 25/02/2008, 08h49   #7
Sukeerthi Adiga
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: NoMethodError: private method `to_date'


> Hi Sukeerthi, Better u change your rails version, Mine is rails 1.2.3,
> The problem what you have sent its working fine.
>
> deepac@deepa-UBUNTU-7:~/workspace/srishti$ script/console
> Loading development environment.
>>> Time.now

> => Mon Feb 25 13:03:46 +0530 2008
>>> a = Time.now

> => Mon Feb 25 13:04:07 +0530 2008
>>> a.to_date

> => #<Date: 4909043/2,0,2299161>
>>> Time.now.to_date

> => #<Date: 4909043/2,0,2299161>
> :0)


Okay deepa let me c that..
Thanks for ur reply
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 25/02/2008, 13h36   #8
Rick DeNatale
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: NoMethodError: private method `to_date'

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 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/

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h49.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,14343 seconds with 16 queries