aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-03-05 09:53:39 +0100
committerYves Senn <yves.senn@gmail.com>2014-03-05 09:53:39 +0100
commit8d486c63d63eeb503fd18be615d5dd26dfa34fb5 (patch)
tree7ca8279c792d684e8f6f97cb3454e870cea5a796 /guides
parent54a120ed553e04acf0ed6345622370ee30b0c690 (diff)
downloadrails-8d486c63d63eeb503fd18be615d5dd26dfa34fb5.tar.gz
rails-8d486c63d63eeb503fd18be615d5dd26dfa34fb5.tar.bz2
rails-8d486c63d63eeb503fd18be615d5dd26dfa34fb5.zip
docs, flash message keys are normalized to strings. [ci skip]
This is a follow up to a668beffd64106a1e1fedb71cc25eaaa11baf0c1
Diffstat (limited to 'guides')
-rw-r--r--guides/source/upgrading_ruby_on_rails.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md
index da124e21a4..7467648d49 100644
--- a/guides/source/upgrading_ruby_on_rails.md
+++ b/guides/source/upgrading_ruby_on_rails.md
@@ -111,6 +111,26 @@ in your application, you can add an initializer file with the following content:
This would transparently migrate your existing `Marshal`-serialized cookies into the
new `JSON`-based format.
+### Flash structure changes
+
+Flash message keys are
+[normalized to strings](https://github.com/rails/rails/commit/a668beffd64106a1e1fedb71cc25eaaa11baf0c1). They
+can still be accessed using either symbols or strings. Lopping through the flash
+will always yield string keys:
+
+```ruby
+flash["string"] = "a string"
+flash[:symbol] = "a symbol"
+
+# Rails < 4.1
+flash.keys # => ["string", :symbol]
+
+# Rails >= 4.1
+flash.keys # => ["string", "symbol"]
+```
+
+Make sure you are comparing Flash message keys against strings.
+
### Changes in JSON handling
There are a few major changes related to JSON handling in Rails 4.1.