3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rails4 ActiveSupport::TimeWithZone as_jsonの仕様変更

Last updated at Posted at 2013-08-20

Rails3からRails4にアップデートする時の細かい変更ポイントです。

ActiveSupport::TimeWithZoneのas_json内で xmlschema -> xmlschema(3)に変更になっています。

time_with_zone.rb
module ActiveSupport
  class TimeWithZone
    def as_json(options = nil)
      if ActiveSupport::JSON::Encoding.use_standard_json_time_format
        xmlschema(3)
      else
        %(#{time.strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)})
      end
    end
  end  
end


Rails3 2013-08-02T09:22:34Z
Rails4 2013-08-02T09:22:34.060Z
という違いになります。

コミットログ
https://github.com/rails/rails/pull/9128

3
3
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?