-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reset HEAD to first commit and reapply changes
- Loading branch information
1 parent
e6f66b0
commit 29e50a0
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# pulled from https://github.com/rails/rails/blob/v3.2.22.5/activesupport/lib/active_support/core_ext/numeric/time.rb | ||
|
||
class Numeric | ||
def days | ||
ActiveSupport::Duration.new(24.hours * self, [[:days, self]]) | ||
end | ||
alias :day :days | ||
|
||
def weeks | ||
ActiveSupport::Duration.new(7.days * self, [[:days, self * 7]]) | ||
end | ||
alias :week :weeks | ||
|
||
def fortnights | ||
ActiveSupport::Duration.new(2.weeks * self, [[:days, self * 14]]) | ||
end | ||
alias :fortnight :fortnights | ||
end | ||
|
||
# pulled from https://github.com/rails/rails/blob/v3.2.22.5/activesupport/lib/active_support/core_ext/integer/time.rb | ||
|
||
class Integer | ||
def months | ||
ActiveSupport::Duration.new(30.days * self, [[:months, self]]) | ||
end | ||
alias :month :months | ||
|
||
def years | ||
ActiveSupport::Duration.new(365.25.days * self, [[:years, self]]) | ||
end | ||
alias :year :years | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# this is a customization created to bridge incompatabilities when upgrading Ruby 2.1.2 | ||
# to 2.4.4 with Rails 3.2. | ||
|
||
#explanation | ||
# Ruby 2.4 unifies Fixnum and Bignum into Integer: https://bugs.ruby-lang.org/issues/12005 | ||
# Ruby ~2.3 `1234.class` is `Fixnum` and `123456789012345678901234567890.class` is `Bignum`. | ||
# Ruby 2.4+ `1234.class` is `Integer` and `123456789012345678901234567890.class` is `Integer`. | ||
|
||
# So for compatability with 2.4 arel defined a visit_Integer method | ||
|
||
# Arel is now bundled in the Active Record gem, and maintained in the rails/rails repository. | ||
# This code can be deleted on update to `activerecord >= 6.0`, which is available in Rails 6.0 | ||
|
||
module Arel | ||
module Visitors | ||
class DepthFirst < Arel::Visitors::Visitor | ||
alias :visit_Integer :terminal | ||
end | ||
|
||
class Dot < Arel::Visitors::Visitor | ||
alias :visit_Integer :visit_String | ||
end | ||
|
||
class ToSql < Arel::Visitors::Visitor | ||
alias :visit_Integer :literal | ||
end | ||
end | ||
end |