.days returning Fixnum instead of Duration #17

rogercampos opened this Issue Sep 14, 2010 · 11 comments


None yet
7 participants

The redefinition of days method in lib/god/sugar.rb:20 makes Date.end_of_week to return wrong dates.



daronco commented Jan 30, 2012

I've seen this problem too.
When using Fixnum#days, #hours or #minutes in an operation with Time objects it works, but it fails with DateTime objects.

> 2012-01-30 18:04:09 -0200
Time.now + 1.day
> 2012-01-31 18:04:20 -0200  # correct

> Mon, 30 Jan 2012 18:03:32 -0200
DateTime.now + 1.day
> Sun, 20 Aug 2248 18:03:49 -0200  # wrong

With god 0.12.1 (and 0.11.0 also) and rails 3.0.11.

More than a year and it's still open. I switched to monit becaus of this.

Can't you just take god out of your Gemfile and install it on your system?

This issue just killed us, please pretty please fix? We're gonna need to switch to monit (ugh). Thanks!


eric commented Mar 19, 2012

How did you run into this? Are you putting "god" in your Gemfile?

If so, try doing this:

gem 'god', :require => false

eric commented Mar 19, 2012

I think it would make a lot of sense in sugar.rb to see if the method is already defined and raise an exception if it is.

It will prevent people from accidentally requiring it.

@eric - yeah , that (putting god in our gemfile) is what we were doing. We'll try the require solution, thanks!

mdarby commented Apr 14, 2012

Just bit me in the ass too. Actually no -- this bit my client in the ass. This smells.


eric commented Apr 14, 2012

I've had a couple ideas for how to solve this:

  1. Raise an exception if god is required when ActiveSupport is found —
    there shouldn't be a reason to use god in other projects
  2. Move everything out of lib/god.rb so if it is automatically
    included in a Gemfile, it won't hurt anything

eric commented Sep 18, 2012

Fixed in 0.13.1.

eric closed this Sep 18, 2012

@sukumarreddy sukumarreddy pushed a commit to m-narayan/agora-conf that referenced this issue Nov 14, 2013

@daronco daronco Fixed an issue in Mconf::DigestEmail that was only happening in produ…
…ction. All production gems are now also installed in development to prevent errors like this.

See: mojombo/god#17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment