[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

can activesupport gem be used in "standalone" fashion?

john peter

3/31/2006 8:10:00 PM

i'm using ruby 1.8.2, rubygem 0.8.10, rails 1.0.0 where activesupport version = 1.2.5

when i try to run this in RADRail, i get a NoMethodError:

require 'rubygems'
require_gem "activesupport"

print Time.now + 2.days

the error message is: c:/e312workspace/first/test3.rb:5: undefined method `days' for 2:Fixnum (NoMethodError)

is there a way to use the numeric/time core_ext in a plain ruby app? if so, how?
thanks for any help!


---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
3 Answers

Michael Guterl

3/31/2006 8:18:00 PM

0

I'm not sure why the above doesn't work, but check below for a working
version.

powerbook:~ michaelguterl$ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'active_support'
=> true
irb(main):003:0> Time.now + 2.days
=> Sun Apr 02 16:16:22 EDT 2006
irb(main):004:0>


On 3/31/06, john peter <neuzhoundxx@yahoo.com> wrote:
>
> i'm using ruby 1.8.2, rubygem 0.8.10, rails 1.0.0 where activesupport
> version = 1.2.5
>
> when i try to run this in RADRail, i get a NoMethodError:
>
> require 'rubygems'
> require_gem "activesupport"
>
> print Time.now + 2.days
>
> the error message is: c:/e312workspace/first/test3.rb:5: undefined method
> `days' for 2:Fixnum (NoMethodError)
>
> is there a way to use the numeric/time core_ext in a plain ruby app? if
> so, how?
> thanks for any help!
>
>
> ---------------------------------
> New Yahoo! Messenger with Voice. Call regular phones from your PC and save
> big.
>

john peter

3/31/2006 8:24:00 PM

0

Thanks! That worked. Not sure what was wrong with require_gem

Michael Guterl <mguterl@gmail.com> wrote: I'm not sure why the above doesn't work, but check below for a working
version.

powerbook:~ michaelguterl$ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'active_support'
=> true
irb(main):003:0> Time.now + 2.days
=> Sun Apr 02 16:16:22 EDT 2006
irb(main):004:0>


On 3/31/06, john peter wrote:
>
> i'm using ruby 1.8.2, rubygem 0.8.10, rails 1.0.0 where activesupport
> version = 1.2.5
>
> when i try to run this in RADRail, i get a NoMethodError:
>
> require 'rubygems'
> require_gem "activesupport"
>
> print Time.now + 2.days
>
> the error message is: c:/e312workspace/first/test3.rb:5: undefined method
> `days' for 2:Fixnum (NoMethodError)
>
> is there a way to use the numeric/time core_ext in a plain ruby app? if
> so, how?
> thanks for any help!
>
>
> ---------------------------------
> New Yahoo! Messenger with Voice. Call regular phones from your PC and save
> big.
>



---------------------------------
Blab-away for as little as 1¢/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice.

Logan Capaldo

3/31/2006 9:03:00 PM

0


On Mar 31, 2006, at 3:23 PM, john peter wrote:

> Thanks! That worked. Not sure what was wrong with require_gem
>

Nothing is wrong with require_gem. It has an unfortunate name though.
It should really be called activate_gem or something similar.
require_gem only actually require's the library if it uses
autorequire, which is deprecated now.
require_gem is to select things like a given version of a gem, ie:
require_gem 'some_gem', '>= 1.0'
you still have to do the
require 'some_gem' line


> Michael Guterl <mguterl@gmail.com> wrote: I'm not sure why the
> above doesn't work, but check below for a working
> version.
>
> powerbook:~ michaelguterl$ irb
> irb(main):001:0> require 'rubygems'
> => true
> irb(main):002:0> require 'active_support'
> => true
> irb(main):003:0> Time.now + 2.days
> => Sun Apr 02 16:16:22 EDT 2006
> irb(main):004:0>
>
>
> On 3/31/06, john peter wrote:
>>
>> i'm using ruby 1.8.2, rubygem 0.8.10, rails 1.0.0 where
>> activesupport
>> version = 1.2.5
>>
>> when i try to run this in RADRail, i get a NoMethodError:
>>
>> require 'rubygems'
>> require_gem "activesupport"
>>
>> print Time.now + 2.days
>>
>> the error message is: c:/e312workspace/first/test3.rb:5: undefined
>> method
>> `days' for 2:Fixnum (NoMethodError)
>>
>> is there a way to use the numeric/time core_ext in a plain ruby
>> app? if
>> so, how?
>> thanks for any help!
>>
>>
>> ---------------------------------
>> New Yahoo! Messenger with Voice. Call regular phones from your PC
>> and save
>> big.
>>
>
>
>
> ---------------------------------
> Blab-away for as little as 1¢/min. Make PC-to-Phone Calls using
> Yahoo! Messenger with Voice.