On Tue, Apr 19, 2011 at 1:08 PM, Philip Hallstrom <[email protected]> wrote:
> > Am still perplexed by this output (ruby 1.8.7-p330 on 64bit/Snow >>> Leopard): >>> > >>> > ruby-1.8.7-p330 :001 > DateTime.now >>> > => #<DateTime 2011-04-18T10:35:18-05:00> >>> > ruby-1.8.7-p330 :002 > DateTime.now + 1.day >>> > => #<DateTime 2247-11-07T10:35:21-05:00> >>> >>> I wonder if it's something along the lines of the value of >>> DateTime.now expressed as an integer added to 1.day expressed as an >>> integer (86400 seconds maybe) converted back to a DateTime - giving a >>> date wayyy in the future... :-/ >>> >>> What happens when you do: >>> DateTime.now + 1.second >>> or >>> DateTime.now + 1.minute >>> etc? >>> >> >> Yeah, I am pending to play around with this a bit later, as I am also >> recalling that ruby 1.9.2 is fine on my computer, so at least try another >> wipe of the 1.8.7. As well see if anything is weird on the config, since as >> to your question, it looks like you are on to something: >> >> ruby-1.8.7-p330 :005 > dt = DateTime.now >> => #<DateTime 2011-04-18T13:23:45-05:00> >> ruby-1.8.7-p330 :006 > dt + 1.second >> => #<DateTime 2011-04-19T13:23:45-05:00> >> ruby-1.8.7-p330 :007 > dt + 1.minute >> => #<DateTime 2011-06-17T13:23:45-05:00> >> >> Because also if I do the following we are right on: >> >> ruby-1.8.7-p330 :008 > dt + 1 >> => #<DateTime 2011-04-19T13:23:45-05:00> >> > > Hi all, so a little more data if it sparks any further input, I appreciate > everyone's input so far: > > I installed fresh ruby 1.8.7-p334 and set up my app and end up with the > same problem as above (DateTime.now + 1.day brings a result with the year > 2247). It has to be something to do with my environment as Phillip Halstrom > above has the same version of ruby and has a good result.... I hate to > rebuild my mac for such a lame issue but I am starting to think about it or > to move this project to a vm. > > What is weird is this: I am poking around > active_support/core_ext/date_time/calculations.rb and see the methods such > as #since, #advance, #past?, etc. available, yet I am getting an error doing > what Michael Pavling suggested above, as well as 'no method found' on the > other methods: > > ruby-1.8.7-p334 :003 > DateTime.now.since(1.day) > NoMethodError: undefined method `since' for #<DateTime > 2011-04-19T12:09:42-05:00 > > Then I decided to check the methods for DateTime.now, in my bad ruby > 1.8.7-p334 / rails 3.0.7, vs my working ruby 1.9.2-p136 / rails 3.0.3. As > you see on the gist below the list of methods are very different. I am > wondering if there is a disconnect in how rails is loading in my 1.8.7 -- > because at initial glance, it looks to me like the DateTime class I am > looking at in active_support is not being loaded as the methods it specifies > are not there. Following are outputs of the methods for DateTime::now for my > 1.8.7/Rails 3.0.7 and 1.9.2/Rails 3.0.3: > > https://gist.github.com/928958 > > > So, if anyone has made it this far, I guess my next question would be as to > how I can confirm whether active support (in particular the file mentioned > above is getting loaded). Actually if Phillip, or someone else (running Ruby > 1.8.7-p334 and Rails 3.0.7 ideally on Snow Leopard mac or close) to this set > up can send me their output of DateTime.now.methods.sort, it would at least > confirm things. > > > ruby 1.8.7, rails 2.3.8.... > http://pastefree.pjkh.com/pastes/155 > > ruby 1.9.2, rails 3.0.7 > http://pastefree.pjkh.com/pastes/156 > > ruby 1.8.7, rails 3.0.7 > http://pastefree.pjkh.com/pastes/157 > Thanks Phillip, well this one confirms my environment has something wrong and is pretty clearly not something wrong with either Rails or Ruby. Well for now I think I am just going to work the project under 1.9.2 and then move it back to 1.8.7 for the client/production, not ideal but nor is creating vm or rebuilding my laptop at the moment. > > -philip > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

