1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

8 commits

Author SHA1 Message Date
Alberto Mota
afa83350de Deprecates Enumerable#sum and Array#sum
Ruby (2.4+) includes a native implementation of `sum` with significant
performance gains. Rails 7.1 will be removing `Enumerable#sum` and
`Array#sum` in favor of Ruby's native implementation.

This commit adds a deprecation warning to calls with non-numeric
arguments without a suitable initial argument as those will be required
once Rails removes this functionality.

Some examples that will now trigger a deprecation warning:
    >> %w[foo bar].sum
    >> [[1, 2], [3, 4, 5]].sum

To avoid the deprecation warning they should now invoked as follows:
    >> %w[foo bar].sum('')
    >> [[1, 2], [3, 4, 5]].sum([])

In order to prepare for the deprecation on Rails 7.1, it also
deprecates `[nil].sum == 0`, which in Ruby's native implementation
throws a `TypeError`.
2021-05-03 10:26:39 -07:00
Jean Boussier
c9a9dcd383 Reproduce the preloader regression in #41596
It's very peculiar, what seem to happen is that if some associations
are already loaded, the batching is done properly.
2021-03-15 12:36:21 -07:00
Kir Shatrov
831be98f9a Use frozen-string-literal in ActiveRecord 2017-07-19 22:27:07 +03:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590, reversing
changes made to afb66a5a59.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Rafael Mendonça França
55f9b8129a
Add three new rubocop rules
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces

Fix all violations in the repository.
2016-08-16 04:30:11 -03:00
Xavier Noria
d22e522179 modernizes hash syntax in activerecord 2016-08-06 19:37:57 +02:00
Bryan Stearns
1080351437 Add failing test that triggers the stack overflow 2010-01-08 21:45:02 +01:00