Permalink
Browse files

Merge pull request #14770 from crazymykl/avoid_dos_vuln_in_i18n_guide

Avoid suggesting dangerous code in i18n guide
  • Loading branch information...
1 parent 5f8b8c3 commit a1439bb8a1dc3d5368dd6bf47f699089140dfd4f @rafaelfranca rafaelfranca committed Apr 16, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 guides/source/i18n.md
View
4 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
```

0 comments on commit a1439bb

Please sign in to comment.