Created
June 22, 2012 22:14
-
-
Save hassox/2975498 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Protect your locales yo! don't specify directly from user input | |
| ## Rails 2.3 ree 1.8.7 | |
| >> Symbol.all_symbols.any?{ |s| s.to_s == "weird string" } | |
| => false | |
| >> I18n.locale = "weird string" | |
| => "weird string" | |
| >> Symbol.all_symbols.any?{ |s| s.to_s == "weird string" } | |
| => true | |
| ## Rails 3.2 | |
| 1.9.3-p194-perf :001 > Symbol.all_symbols.any?{ |s| s.to_s == "weird string" } | |
| => false | |
| 1.9.3-p194-perf :002 > I18n.locale = "weird string" | |
| => "weird string" | |
| 1.9.3-p194-perf :003 > Symbol.all_symbols.any?{ |s| s.to_s == "weird string" } | |
| => true | |
| 1.9.3-p194-perf :004 > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment