File tree 4 files changed +9
-16
lines changed
railties/lib/rails/generators/rails/app/templates/config/initializers
4 files changed +9
-16
lines changed Original file line number Diff line number Diff line change 1
1
*Edge*
2
2
3
+ * Changed the default ActiveSupport.use_standard_json_time_format from false to true and
4
+ ActiveSupport.escape_html_entities_in_json from true to false to match previously announced Rails 3 defaults [DHH]
5
+
3
6
* Added Object#presence that returns the object if it's #present? otherwise returns nil [DHH/Colin Kelley]
4
7
5
8
* Add Enumerable#exclude? to bring parity to Enumerable#include? and avoid if !x.include?/else calls [DHH]
Original file line number Diff line number Diff line change @@ -114,7 +114,8 @@ def escape(string)
114
114
end
115
115
end
116
116
117
- self . escape_html_entities_in_json = true
117
+ self . use_standard_json_time_format = true
118
+ self . escape_html_entities_in_json = false
118
119
end
119
120
120
121
CircularReferenceError = Deprecation ::DeprecatedConstantProxy . new ( 'ActiveSupport::JSON::CircularReferenceError' , Encoding ::CircularReferenceError )
Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ module ActiveSupport
32
32
# t.is_a?(Time) # => true
33
33
# t.is_a?(ActiveSupport::TimeWithZone) # => true
34
34
class TimeWithZone
35
-
36
35
def self . name
37
36
'Time' # Report class name as 'Time' to thwart type checking
38
37
end
@@ -114,9 +113,9 @@ def xmlschema(fraction_digits = 0)
114
113
end
115
114
alias_method :iso8601 , :xmlschema
116
115
117
- # Coerces the date to a string for JSON encoding.
118
- #
119
- # ISO 8601 format is used if ActiveSupport::JSON::Encoding.use_standard_json_time_format is set .
116
+ # Coerces the date to a string for JSON encoding. The default format is ISO 8601. You can get
117
+ # %Y/%m/%d %H:%M:%S +offset style by setting ActiveSupport::JSON::Encoding.use_standard_json_time_format
118
+ # to false .
120
119
#
121
120
# ==== Examples
122
121
#
Original file line number Diff line number Diff line change 4
4
# for Rails 3. You can remove this initializer when Rails 3 is released.
5
5
6
6
if defined? ( ActiveRecord )
7
- # Include Active Record class name as root for JSON serialized output.
8
- ActiveRecord ::Base . include_root_in_json = true
9
-
10
7
# Store the full class name (including module namespace) in STI type column.
11
8
ActiveRecord ::Base . store_full_sti_class = true
12
- end
13
-
14
- # Use ISO 8601 format for JSON serialized times and dates.
15
- ActiveSupport . use_standard_json_time_format = true
16
-
17
- # Don't escape HTML entities in JSON, leave that for the #json_escape helper.
18
- # if you're including raw json in an HTML page.
19
- ActiveSupport . escape_html_entities_in_json = false
9
+ end
You can’t perform that action at this time.
0 commit comments