aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/json/encoders/date.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/json/encoders/date.rb')
-rw-r--r--activesupport/lib/active_support/json/encoders/date.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/json/encoders/date.rb b/activesupport/lib/active_support/json/encoders/date.rb
index 853d9b868c..d55f17962b 100644
--- a/activesupport/lib/active_support/json/encoders/date.rb
+++ b/activesupport/lib/active_support/json/encoders/date.rb
@@ -1,5 +1,10 @@
class Date
- def to_json(options = nil) #:nodoc:
+ # Returns a JSON string representing the date.
+ #
+ # ==== Example:
+ # Date.new(2005,2,1).to_json
+ # # => "2005/02/01"
+ def to_json(options = nil)
%("#{strftime("%Y/%m/%d")}")
end
end