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...
2 parents e665ce7 + 19b2bcc commit d46771b6fe19302a8808e230bd2fee98d07b87c4 @rafaelfranca rafaelfranca committed Apr 16, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 guides/source/i18n.md
View
@@ -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 d46771b

Please sign in to comment.