Please, help to solve the problem

$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
$ irb
1.9.3p0 :001 > require ‘rubygems’
=> false
1.9.3p0 :002 > require ‘active_support/core_ext/date/calculations.rb’
=> true
1.9.3p0 :003 > require ‘active_support/core_ext/integer/time.rb’
=> true
1.9.3p0 :004 > require ‘active_support/core_ext/numeric/time.rb’
=> true
1.9.3p0 :005 > 0.months.since Date.current
ArgumentError: expected a time or date, got #<Date: 2012-08-05
((2456145j,0s,0n),+0s,2299161j)>
from
/home/d/.rvm/gems/[email protected]/gems/activesupport-3.2.7/lib/active_support/basic_object.rb:11:in
raise' from /home/d/.rvm/gems/ruby-1.9.3-p0\@t/gems/activesupport-3.2.7/lib/active_support/duration.rb:99:inblock in sum’
from
/home/d/.rvm/gems/[email protected]/gems/activesupport-3.2.7/lib/active_support/duration.rb:91:in
each' from /home/d/.rvm/gems/ruby-1.9.3-p0\@t/gems/activesupport-3.2.7/lib/active_support/duration.rb:91:ininject’
from
/home/d/.rvm/gems/[email protected]/gems/activesupport-3.2.7/lib/active_support/duration.rb:91:in
sum' from /home/d/.rvm/gems/ruby-1.9.3-p0\@t/gems/activesupport-3.2.7/lib/active_support/duration.rb:63:insince’
from (irb):5
from /home/d/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `’

With 1.8.7:
ArgumentError: expected a time or date, got #<Date: 4912289/2,0,2299161>
from
/var/lib/gems/1.8/gems/activesupport-3.2.7/lib/active_support/duration.rb:99:in
sum' from (irb):6:ininject’
from
/var/lib/gems/1.8/gems/activesupport-3.2.7/lib/active_support/duration.rb:91:in
each' from /var/lib/gems/1.8/gems/activesupport-3.2.7/lib/active_support/duration.rb:91:ininject’
from
/var/lib/gems/1.8/gems/activesupport-3.2.7/lib/active_support/duration.rb:91:in
sum' from /var/lib/gems/1.8/gems/activesupport-3.2.7/lib/active_support/duration.rb:63:insince’
from (irb):6
from :0

thank you in advance

Dmitri K. wrote in post #1071361:

$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
$ irb
1.9.3p0 :001 > require ‘rubygems’
=> false
1.9.3p0 :002 > require ‘active_support/core_ext/date/calculations.rb’
=> true
1.9.3p0 :003 > require ‘active_support/core_ext/integer/time.rb’
=> true
1.9.3p0 :004 > require ‘active_support/core_ext/numeric/time.rb’
=> true
1.9.3p0 :005 > 0.months.since Date.current
ArgumentError: expected a time or date, got #<Date: 2012-08-05
((2456145j,0s,0n),+0s,2299161j)>

Since this statement works fine if all of Rails is loaded then you must
still be missing some required files.

$ rails c
Loading development environment (Rails 3.2.7)
irb(main):001:0> Date.current
=> Sun, 05 Aug 2012
irb(main):002:0> 0.months.since Date.current
=> Sun, 05 Aug 2012

require “active_support/core_ext/date/acts_like”
miss this for acts_like_date? function.

i think you can easy to this.

require ‘active_support/core_ext’
puts 0.months.since Date.current

On Sunday, August 5, 2012 7:05:11 PM UTC+3, Ruby-Forum.com User wrote:

irb(main):002:0> 0.months.since Date.current
=> Sun, 05 Aug 2012


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

Yes, in rails it works, I know. But I do not need to load the whole
framework for just the data manipulation. What file is missing to load?