$ 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/ruby-1.9.3-p0\@t/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:in `block in sum'' from /home/d/.rvm/gems/ruby-1.9.3-p0\@t/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:in `inject'' from /home/d/.rvm/gems/ruby-1.9.3-p0\@t/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:in `since'' from (irb):5 from /home/d/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>'' 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:in `inject'' 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:in `inject'' 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:in `since'' from (irb):6 from :0 thank you in advance -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Cnaj1XYeXZAJ. For more options, visit https://groups.google.com/groups/opt_out.
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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On Sunday, August 5, 2012 7:05:11 PM UTC+3, Ruby-Forum.com User wrote:> > > 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 > > -- > 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? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/SC86H6UDa7oJ. For more options, visit https://groups.google.com/groups/opt_out.
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 Mon, Aug 6, 2012 at 1:06 AM, koulikoff <koulikoff-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Sunday, August 5, 2012 7:05:11 PM UTC+3, Ruby-Forum.com User wrote: >> >> >> 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 >> >> -- >> 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? > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/SC86H6UDa7oJ. > > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On Monday, August 6, 2012 5:42:49 AM UTC+3, hhuai wrote:> > require "active_support/core_ext/date/acts_like" > miss this for acts_like_date? function. > > Yes, thank you very much-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/ZyAm9c2ONs4J. For more options, visit https://groups.google.com/groups/opt_out.