Permalink
Browse files

Changed the default ActiveSupport.use_standard_json_time_format from …

…false to true and

ActiveSupport.escape_html_entities_in_json from true to false to match previously announced Rails 3 defaults [DHH]
  • Loading branch information...
1 parent 532b116 commit 6042067c0b20602e72954450e9e8a19dfa8a9f7d @dhh dhh committed Jan 4, 2010
@@ -1,5 +1,8 @@
*Edge*
+* Changed the default ActiveSupport.use_standard_json_time_format from false to true and
+ActiveSupport.escape_html_entities_in_json from true to false to match previously announced Rails 3 defaults [DHH]
+
* Added Object#presence that returns the object if it's #present? otherwise returns nil [DHH/Colin Kelley]
* Add Enumerable#exclude? to bring parity to Enumerable#include? and avoid if !x.include?/else calls [DHH]
@@ -114,7 +114,8 @@ def escape(string)
end
end
- self.escape_html_entities_in_json = true
+ self.use_standard_json_time_format = true
+ self.escape_html_entities_in_json = false
end
CircularReferenceError = Deprecation::DeprecatedConstantProxy.new('ActiveSupport::JSON::CircularReferenceError', Encoding::CircularReferenceError)
@@ -32,7 +32,6 @@ module ActiveSupport
# t.is_a?(Time) # => true
# t.is_a?(ActiveSupport::TimeWithZone) # => true
class TimeWithZone
-
def self.name
'Time' # Report class name as 'Time' to thwart type checking
end
@@ -114,9 +113,9 @@ def xmlschema(fraction_digits = 0)
end
alias_method :iso8601, :xmlschema
- # Coerces the date to a string for JSON encoding.
- #
- # ISO 8601 format is used if ActiveSupport::JSON::Encoding.use_standard_json_time_format is set.
+ # Coerces the date to a string for JSON encoding. The default format is ISO 8601. You can get
+ # %Y/%m/%d %H:%M:%S +offset style by setting ActiveSupport::JSON::Encoding.use_standard_json_time_format
+ # to false.
#
# ==== Examples
#
@@ -4,16 +4,6 @@
# for Rails 3. You can remove this initializer when Rails 3 is released.
if defined?(ActiveRecord)
- # Include Active Record class name as root for JSON serialized output.
- ActiveRecord::Base.include_root_in_json = true
-
# Store the full class name (including module namespace) in STI type column.
ActiveRecord::Base.store_full_sti_class = true
-end
-
-# Use ISO 8601 format for JSON serialized times and dates.
-ActiveSupport.use_standard_json_time_format = true
-
-# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
-# if you're including raw json in an HTML page.
-ActiveSupport.escape_html_entities_in_json = false
+end

0 comments on commit 6042067

Please sign in to comment.