Created
October 20, 2010 06:34
-
-
Save ejfinneran/635898 to your computer and use it in GitHub Desktop.
What is up with JSON encoding on ActiveModel::Errors?
This file contains 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
ruby-1.8.7-p302 > hash | |
=> #<OrderedHash {:email=>["is too short (minimum is 6 characters)", "should look like an email address."]}> | |
ruby-1.8.7-p302 > u.errors | |
=> #<OrderedHash {:email=>["is too short (minimum is 6 characters)", "should look like an email address."]}> | |
ruby-1.8.7-p302 > hash == u.errors | |
=> true | |
ruby-1.8.7-p302 > hash.to_json == u.errors.to_json | |
=> false | |
ruby-1.8.7-p302 > hash.to_json | |
=> "{\"email\":[\"is too short (minimum is 6 characters)\",\"should look like an email address.\"]}" | |
ruby-1.8.7-p302 > u.errors.to_json | |
=> "{\"email\":\"is too short (minimum is 6 characters)\",\"email\":\"should look like an email address.\"}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment