diff options
author | Zachary Scott <e@zzak.io> | 2014-07-09 16:44:44 -0700 |
---|---|---|
committer | Zachary Scott <e@zzak.io> | 2014-07-09 16:44:44 -0700 |
commit | f149e71d0b574034ff79bdc9bb80876a86ec03d6 (patch) | |
tree | 6caad4db7760ba2587264401f2a29abe57183427 | |
parent | cb377455fe9b97e4760d3b7b4af1b1a004a3f14b (diff) | |
parent | d703fe5fff6eed15274f461087b3a9dcadaa7531 (diff) | |
download | rails-f149e71d0b574034ff79bdc9bb80876a86ec03d6.tar.gz rails-f149e71d0b574034ff79bdc9bb80876a86ec03d6.tar.bz2 rails-f149e71d0b574034ff79bdc9bb80876a86ec03d6.zip |
Merge pull request #16113 from egilburg/rails_4_1_upgrade_guide_json_time_with_zone_precision
[ci skip] Document millisecond precision change in ActiveSupport::TimeWithZone#as_json
-rw-r--r-- | guides/source/upgrading_ruby_on_rails.md | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 1e752b449d..36cd505977 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -241,6 +241,16 @@ If your application depends on one of these features, you can get them back by adding the [`activesupport-json_encoder`](https://github.com/rails/activesupport-json_encoder) gem to your Gemfile. +#### JSON representation of Time objects + +`#as_json` for objects with time component (`Time`, `DateTime`, `ActiveSupport::TimeWithZone`) +now returns millisecond precision by default. If you need to keep old behavior with no millisecond +precision, set the following in an initializer: + +``` +ActiveSupport::JSON::Encoding.time_precision = 0 +``` + ### Usage of `return` within inline callback blocks Previously, Rails allowed inline callback blocks to use `return` this way: @@ -434,8 +444,8 @@ string keys consistently. ### Explicit block use for `ActiveSupport::Callbacks` -Rails 4.1 now expects an explicit block to be passed when calling -`ActiveSupport::Callbacks.set_callback`. This change stems from +Rails 4.1 now expects an explicit block to be passed when calling +`ActiveSupport::Callbacks.set_callback`. This change stems from `ActiveSupport::Callbacks` being largely rewritten for the 4.1 release. ```ruby |