Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.days returning Fixnum instead of Duration #17

Closed
rogercampos opened this issue Sep 14, 2010 · 11 comments
Closed

.days returning Fixnum instead of Duration #17

rogercampos opened this issue Sep 14, 2010 · 11 comments

Comments

@rogercampos
Copy link

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

https://rails.lighthouseapp.com/projects/8994/tickets/5548-dateend_of_week-not-working-in-production-mode

@kaluznyo
Copy link

+1

@daronco
Copy link

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.

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

DateTime.now
> 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.

@rogercampos
Copy link
Author

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

@jnwheeler44
Copy link

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

@mdesjardins
Copy link

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

@eric
Copy link
Collaborator

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
Copy link
Collaborator

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.

@mdesjardins
Copy link

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

@mdarby
Copy link

mdarby commented Apr 14, 2012

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

@eric
Copy link
Collaborator

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
Copy link
Collaborator

eric commented Sep 18, 2012

Fixed in 0.13.1.

@eric eric closed this as completed Sep 18, 2012
sukumarreddy pushed a commit to m-narayan/agora-conf that referenced this issue Nov 14, 2013
…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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants