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

Use .nil? instead of == nil #210

Merged
merged 1 commit into from
Jun 21, 2016
Merged

Use .nil? instead of == nil #210

merged 1 commit into from
Jun 21, 2016

Conversation

paulodelgado
Copy link
Contributor

I was having issues with rufus + ActiveSupport(3.2.22)

When checking for @started_at == nil my system tried to use ActiveSupport's "compare_with_coercion" which ended up failing trying to run .to_datetime on null.

Not sure if I'm fixing this in the right place but I thought I'd give it a try.

Its ruby and doesn't rely on ActiveSupport.

Plus it works in my env.
@jmettraux
Copy link
Owner

Hello,

thanks for the report.

May I see the error and its backtrace?

Thanks in advance.

@paulodelgado
Copy link
Contributor Author

paulodelgado commented Jun 21, 2016

This was the error on AS 3.2.12

rake aborted!
NoMethodError: undefined method `to_datetime' for nil:NilClass
/home/username/.rvm/gems/ruby-2.3.1@project/gems/activesupport-3.2.12/lib/active_support/core_ext/date_time/calculations.rb:141:in `<=>'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/activesupport-3.2.12/lib/active_support/core_ext/time/calculations.rb:346:in `compare_with_coercion'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/rufus-scheduler-3.2.1/lib/rufus/scheduler.rb:612:in `=='
/home/username/.rvm/gems/ruby-2.3.1@project/gems/rufus-scheduler-3.2.1/lib/rufus/scheduler.rb:612:in `do_schedule'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/rufus-scheduler-3.2.1/lib/rufus/scheduler.rb:225:in `every'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler.rb:142:in `block in load_schedule_job'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler.rb:137:in `each'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler.rb:137:in `load_schedule_job'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler.rb:99:in `block in load_schedule!'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler.rb:98:in `each'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler.rb:98:in `load_schedule!'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler.rb:52:in `run'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler/cli.rb:117:in `run_forever'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler/tasks.rb:18:in `block (2 levels) in <top (required)>'
/home/username/.rvm/gems/ruby-2.3.1@project/bin/ruby_executable_hooks:15:in `eval'
/home/username/.rvm/gems/ruby-2.3.1@project/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => resque:scheduler

And this is the error on AS 3.2.22

NameError: uninitialized constant DateTime::Infinity
/home/username/.rvm/gems/ruby-2.3.1@project/gems/activesupport-3.2.22/lib/active_support/core_ext/date_time/calculations.rb:141:in `<=>'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/activesupport-3.2.22/lib/active_support/core_ext/time/calculations.rb:359:in `compare_with_coercion'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/rufus-scheduler-3.2.1/lib/rufus/scheduler.rb:612:in `=='
/home/username/.rvm/gems/ruby-2.3.1@project/gems/rufus-scheduler-3.2.1/lib/rufus/scheduler.rb:612:in `do_schedule'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/rufus-scheduler-3.2.1/lib/rufus/scheduler.rb:225:in `every'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler.rb:142:in `block in load_schedule_job'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler.rb:137:in `each'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler.rb:137:in `load_schedule_job'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler.rb:99:in `block in load_schedule!'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler.rb:98:in `each'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler.rb:98:in `load_schedule!'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler.rb:52:in `run'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler/cli.rb:117:in `run_forever'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/resque-scheduler-4.2.0/lib/resque/scheduler/tasks.rb:18:in `block (2 levels) in <top (required)>'
/home/username/.rvm/gems/ruby-2.3.1@project/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
/home/username/.rvm/gems/ruby-2.3.1@project/bin/ruby_executable_hooks:15:in `eval'
/home/username/.rvm/gems/ruby-2.3.1@project/bin/ruby_executable_hooks:15:in `<main>'

@jmettraux jmettraux merged commit f80a0aa into jmettraux:master Jun 21, 2016
@jmettraux
Copy link
Owner

Thanks a lot!

@jmettraux
Copy link
Owner

jmettraux commented Jun 21, 2016

(somehow I can't stop thinking there is something very wrong with ActiveSupport here, they're breaking Ruby)

@paulodelgado
Copy link
Contributor Author

Its weird, yes. I wonder if @tenderlove has ideas here. Can I tag him here?

@jmettraux
Copy link
Owner

jmettraux commented Jun 21, 2016

You just did. I'm a bit old, I'd rather first build some evidence then report to the maintainers of ActiveSupport, if there is anything to report, rather than ping one maintainer out of the blue with an issue on a library not linked to ActiveSupport.

@jmettraux
Copy link
Owner

Investigating in https://github.com/jmettraux/as_equal_equal ...

@jmettraux
Copy link
Owner

Hello @paulodelgado,

I've built https://github.com/jmettraux/as_equal_equal to try and reproduce your issue, but without success. Please try it with your 2.3.1 Ruby (I limited myself to a 2.1.3 I have lying around). If you can build on that as_equal_equal and reproduce the issue, that's worth reporting somewhere.

Best regards.

@paulodelgado
Copy link
Contributor Author

Interesting, I'm also unable to reproduce it. I got some work to do so i'll try again later. Thanks for taking a look at it!

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

Successfully merging this pull request may close these issues.

2 participants