aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-04-15 22:21:13 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-04-15 22:21:13 -0300
commitd46771b6fe19302a8808e230bd2fee98d07b87c4 (patch)
treec5fbe8b352b3dba6db59dc031c3f2e7a46ce6505 /guides/source
parente665ce714133bfc0b45a20359c7d5af86bfb54d9 (diff)
parent19b2bcc76dde5f35d9b98ecf04c95198ab91dacc (diff)
downloadrails-d46771b6fe19302a8808e230bd2fee98d07b87c4.tar.gz
rails-d46771b6fe19302a8808e230bd2fee98d07b87c4.tar.bz2
rails-d46771b6fe19302a8808e230bd2fee98d07b87c4.zip
Merge pull request #14770 from crazymykl/avoid_dos_vuln_in_i18n_guide
Avoid suggesting dangerous code in i18n guide
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/i18n.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/guides/source/i18n.md b/guides/source/i18n.md
index 466ffe7907..62516bfd75 100644
--- a/guides/source/i18n.md
+++ b/guides/source/i18n.md
@@ -179,7 +179,7 @@ end
# in your /etc/hosts file to try this out locally
def extract_locale_from_tld
parsed_locale = request.host.split('.').last
- I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil
+ I18n.available_locales.map(&:to_s).include?(parsed_locale) ? parsed_locale : nil
end
```
@@ -192,7 +192,7 @@ We can also set the locale from the _subdomain_ in a very similar way:
# in your /etc/hosts file to try this out locally
def extract_locale_from_subdomain
parsed_locale = request.subdomains.first
- I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil
+ I18n.available_locales.map(&:to_s).include?(parsed_locale) ? parsed_locale : nil
end
```