Skip to content

Create a blacklist to disallow mutator methods to be delegated to Array#13314

Merged
jeremy merged 1 commit intorails:masterfrom
laurocaetano:blacklist_array_methods
Dec 17, 2013
Merged

Create a blacklist to disallow mutator methods to be delegated to Array#13314
jeremy merged 1 commit intorails:masterfrom
laurocaetano:blacklist_array_methods

Conversation

@laurocaetano
Copy link
Contributor

This change was necessary because the whitelist wouldn't work.
It would be painful for users trying to update their applications.

Related with: #12129

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def array_delegable?(method)
  Array.method_defined?(method) && BLACKLISTED_ARRAY_METHODS.exclude?(method)
end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch 😄

@jeremy
Copy link
Member

jeremy commented Dec 16, 2013

Please rebase ❤️

@laurocaetano
Copy link
Contributor Author

rebased 💚

…ray`.

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`.
jeremy added a commit that referenced this pull request Dec 17, 2013
Create a blacklist to disallow mutator methods to be delegated to Array

Conflicts:
	guides/source/upgrading_ruby_on_rails.md
@jeremy jeremy merged commit d4ee09c into rails:master Dec 17, 2013
@laurocaetano
Copy link
Contributor Author

💚 ❤️ 💙 💛

oliverguenther added a commit to oliverguenther/openproject that referenced this pull request Aug 10, 2015
rails/rails#13314 removed mutator methods
(e.g., `Array#sort!`) from relations.

This commit enforces returned work packages to be ordered by ID instead.
oliverguenther added a commit to oliverguenther/openproject that referenced this pull request Aug 11, 2015
rails/rails#13314 removed mutator methods
(e.g., `Array#sort!`) from relations.

This commit enforces either an ordering on the query itself where
applicable, or uses a non-mutator sort.
myabc pushed a commit to myabc/openproject that referenced this pull request Aug 19, 2015
rails/rails#13314 removed mutator methods
(e.g., `Array#sort!`) from relations.

This commit enforces either an ordering on the query itself where
applicable, or uses a non-mutator sort.
myabc added a commit to eurucamp/eurucamp-activities that referenced this pull request Mar 11, 2017
rails/rails#13314 removed mutator methods
(e.g., `Array#sort!`) from relations.
myabc added a commit to eurucamp/eurucamp-activities that referenced this pull request Apr 10, 2018
rails/rails#13314 removed mutator methods
(e.g., `Array#sort!`) from relations.
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

Successfully merging this pull request may close these issues.

5 participants