Permalink
Browse files

Merge pull request #14770 from crazymykl/avoid_dos_vuln_in_i18n_guide

Avoid suggesting dangerous code in i18n guide
Conflicts:
	guides/source/i18n.md
  • Loading branch information...
1 parent b0fa1a6 commit 112896b5e1686b6cea6a010049d7dbf498cb0fb6 @rafaelfranca rafaelfranca committed Apr 16, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 guides/source/i18n.md
View
@@ -174,7 +174,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
```
@@ -187,7 +187,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 112896b

Please sign in to comment.