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

undefined method `to_r' for 61200.0:Float - in Ruby 1.8.7 #34

Closed
swalberg opened this issue Jul 31, 2012 · 1 comment
Closed

undefined method `to_r' for 61200.0:Float - in Ruby 1.8.7 #34

swalberg opened this issue Jul 31, 2012 · 1 comment

Comments

@swalberg
Copy link

I get the following error in ree 1.8.7 using Timecop 0.4.4 (or 0.4.1) and Rails 3.0. If I go back to Timecop 0.3.5 it works. It also works if I update to Ruby 1.9.3 (which unfortunately isn't an option for me at the moment). Have also tested this in a different Rails 3.2 project with the same results.

>> Timecop.freeze(Time.parse("2011-12-10 13:00-0400")) { puts DateTime.now }
NoMethodError: undefined method `to_r' for 61200.0:Float
    from /Users/sean/.rvm/rubies/ree-1.8.7-2012.02/lib/ruby/1.8/date.rb:527:in `time_to_day_fraction'
    from /Users/sean/.rvm/rubies/ree-1.8.7-2012.02/lib/ruby/1.8/date.rb:707:in `valid_time?'
    from /Users/sean/.rvm/rubies/ree-1.8.7-2012.02/lib/ruby/1.8/date.rb:1521:in `new'
    from /Users/sean/.rvm/gems/ree-1.8.7-2012.02/gems/timecop-0.4.1/lib/timecop/time_stack_item.rb:64:in `datetime'
    from /Users/sean/.rvm/gems/ree-1.8.7-2012.02/gems/timecop-0.4.1/lib/timecop/time_extensions.rb:53:in `mock_time'
    from /Users/sean/.rvm/gems/ree-1.8.7-2012.02/gems/timecop-0.4.1/lib/timecop/time_extensions.rb:66:in `now'
    from (irb):1
    from /Users/sean/.rvm/gems/ree-1.8.7-2012.02/gems/timecop-0.4.1/lib/timecop/timecop.rb:109:in `travel'
    from /Users/sean/.rvm/gems/ree-1.8.7-2012.02/gems/timecop-0.4.1/lib/timecop/timecop.rb:49:in `send'
    from /Users/sean/.rvm/gems/ree-1.8.7-2012.02/gems/timecop-0.4.1/lib/timecop/timecop.rb:49:in `freeze'
    from (irb):1
>> Timecop.freeze(Time.parse("2011-12-10 13:00-0400")) { puts Time.now }
2011-12-10 17:00:00 UTC
@travisjeffery
Copy link
Owner

This is a bug in REE that was patched even in MRI, http://bugs.ruby-lang.org/issues/4644.

Unless many others have this problem, my advice is to stick with 0.3.5 until you're off REE, or bug them to make a similar patch.

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

2 participants