9. A Story...
Once upon a time there was a Rails app,
that needed to be ported to JRuby
• Ditch C-extensions
• Look for JRuby specific versions of gems
• Find a good app server
• Run your test suite!
10. What do you do
when...
ArgumentError: comparison of ActiveSupport::TimeWithZone
with ActiveSupport::TimeWithZone failed
20. We Have to go
Deeper!
activesupport-3.2.13/lib/active_support/core_ext/time/zones.rb
activesupport-3.2.13/lib/active_support/core_ext/date_time/zones.rb
21. We Have to go
Deeper!
Read Code
...and Comments
22. So Far...
• TimeWithZone initializes @utc to a Time
or DateTime
• Comparison with <=> passes through
“other” to @utc’s <=> operator
32. Getting to the Heart of
the Matter: MRI
• If “other” is a Time object, compare
• If not, call <=> on other, passing self as the
argument
• If that works, take the negation of the
result
• Otherwise: nil
50. The Moral
• When MRI was the only game in town,
whatever MRI did was “Ruby”
• Re-implementing “Ruby” allows us to
reconsider behaviors
• The key is communication and community