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

10 commits

Author SHA1 Message Date
Lauro Caetano
d4ee09cda1 Create a blacklist to disallow mutator methods to be delegated to Array.
This change was necessary because the whitelist wouldn't work.
It would be painful for users trying to update their applications.

This blacklist intent to prevent odd bugs and confusion in code that call mutator
methods directely on the `Relation`.
2013-12-17 13:43:10 -02:00
Jeremy Kemper
0b142a6f84 Add a bunch of Relation -> Array delegate methods to the whitelist. This won't last - aim to switch back to a blacklist for mutator methods. 2013-12-12 21:10:03 -07:00
Lauro Caetano
1244aa7c5f Use public_send instead of just use send. 2013-12-12 20:19:04 -02:00
Lauro Caetano
aa85bdba68 Use a whitelist to delegate methods to array 2013-12-12 19:34:47 -02:00
Akshay Vishnoi
5a406ff42e delgated => delegated 2013-11-25 14:09:44 +05:30
Akira Matsuda
3ce9e43bc3 Avoid sorting an Array including objects from different Classes
addresses "ArgumentError: comparison of VerySpecialComment with SpecialComment failed" in ActiveRecord::DelegationRelationTest#test_#sort!_delegation_is_deprecated
2013-11-11 19:53:54 +09:00
Akira Matsuda
48b10134a5 Load test fixtures where data are needed
Without this, some tests here were not actually testing anything.
2013-11-11 19:53:54 +09:00
Akira Matsuda
9222928dfb A tiny grammatical fix
[ci skip]
2013-11-11 19:14:42 +09:00
Federico Ravasio
0aeb11e575 Allow methods arity below -1 in assert_responds.
Every method from MRI's core classes is written in C. This means
Method#arity always returns -1 for methods with a variable number of
arguments. This is not the case with Rubinius, where, for example
Array#slice! is implemented in Ruby and has arity -2, since is
defined as def slice!(start, length = undefined)
2013-10-08 00:15:11 +02:00
Ben Woosley
1a40be0211 Deprecate the delegation of Array bang methods in ActiveRecord::Delegation
The primary means of returning results for Array bang methods is to modify
the array in-place. When you call these methods on a relation, that
array is created, modified, and then thrown away. Only the secondary
return value is exposed to the caller.

Removing this delegation is a straight-forward way to reduce user error
by forcing callers to first explicitly call #to_a in order to expose
the array to be acted on by the bang method.
2013-09-04 01:32:27 -07:00