Permalink
Browse files

[ci skip] doc ActiveSupport::TimeWithZone#to_s

Current docs are wrong. Does not accept strftime inputs.
  • Loading branch information...
1 parent aabbf07 commit 7063e254bf2a24cda7d7f3e07ba50ac1b44a8d2f @schneems schneems committed May 9, 2014
Showing with 5 additions and 2 deletions.
  1. +5 −2 activesupport/lib/active_support/time_with_zone.rb
@@ -185,8 +185,11 @@ def rfc2822
end
alias_method :rfc822, :rfc2822
- # <tt>:db</tt> format outputs time in UTC; all others output time in local.
- # Uses TimeWithZone's +strftime+, so <tt>%Z</tt> and <tt>%z</tt> work correctly.
+ # Returns a string of the object's date and time.
+ # 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)
if format == :db
utc.to_s(format)

0 comments on commit 7063e25

Please sign in to comment.