aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2013-12-17 11:29:23 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2013-12-17 11:29:23 -0700
commit2b096c7170bd8b4892fb3902741c8a4c21e962b2 (patch)
treea89771f47e4d2c9aed0c63c3092346b58bd610f5 /guides/source
parent83e4dde41a09bf501c41386f874a83b2f50af5f3 (diff)
parentd4ee09cda135da9c36a5ddadd2d8c2d35c116be3 (diff)
downloadrails-2b096c7170bd8b4892fb3902741c8a4c21e962b2.tar.gz
rails-2b096c7170bd8b4892fb3902741c8a4c21e962b2.tar.bz2
rails-2b096c7170bd8b4892fb3902741c8a4c21e962b2.zip
Merge pull request #13314 from laurocaetano/blacklist_array_methods
Create a blacklist to disallow mutator methods to be delegated to Array Conflicts: guides/source/upgrading_ruby_on_rails.md
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/upgrading_ruby_on_rails.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md
index b838874e2b..33e58f892e 100644
--- a/guides/source/upgrading_ruby_on_rails.md
+++ b/guides/source/upgrading_ruby_on_rails.md
@@ -200,6 +200,23 @@ Note that this option was added as a security measure, to ensure user input coul
not be used as locale information unless previously known, so it's recommended not
to disable this option unless you have a strong reason for doing so.
+### Mutator methods called on Relation
+
+`Relation` no longer has mutator methods like `#map!` and `#delete_if`. Convert
+to an `Array` by calling `#to_a` before using these methods.
+
+It intends to prevent odd bugs and confusion in code that call mutator
+methods directly on the `Relation`.
+
+```ruby
+# Instead of this
+Author.where(name: 'Hank Moody').compact!
+
+# Now you have to do this
+authors = Author.where(name: 'Hank Moody').to_a
+authors.compact!
+```
+
Upgrading from Rails 3.2 to Rails 4.0
-------------------------------------