1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

[ci skip] doc ActiveSupport::TimeWithZone#to_s

Current docs are wrong. Does not accept strftime inputs.
This commit is contained in:
schneems 2014-05-09 11:50:35 -05:00
parent aabbf07d00
commit 7063e254bf

View file

@ -185,8 +185,11 @@ module ActiveSupport
end end
alias_method :rfc822, :rfc2822 alias_method :rfc822, :rfc2822
# <tt>:db</tt> format outputs time in UTC; all others output time in local. # Returns a string of the object's date and time.
# Uses TimeWithZone's +strftime+, so <tt>%Z</tt> and <tt>%z</tt> work correctly. # Accepts an optional <tt>format</tt>:
# * <tt>:default</tt> - default value, mimics Ruby 1.9 Time#to_s format.
# * <tt>:db</tt> - format outputs time in UTC :db time. See Time#to_formatted_s(:db).
# * Any key in <tt>Time::DATE_FORMATS</tt> can be used. See active_support/core_ext/time/conversions.rb.
def to_s(format = :default) def to_s(format = :default)
if format == :db if format == :db
utc.to_s(format) utc.to_s(format)