Skip to content

Commit

Permalink
Merge pull request #14770 from crazymykl/avoid_dos_vuln_in_i18n_guide
Browse files Browse the repository at this point in the history
Avoid suggesting dangerous code in i18n guide
  • Loading branch information
rafaelfranca committed Apr 16, 2014
2 parents e665ce7 + 19b2bcc commit d46771b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions guides/source/i18n.md
Expand Up @@ -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
```

Expand All @@ -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
```

Expand Down

0 comments on commit d46771b

Please sign in to comment.