I'm successfully using a duck punch to reformat the date returned by datetime, based on the helpful response given to someone else's question here:
I'm now trying to do a very similar thing for a date object (rather than datetime), so I've modified the patch as follows:
class ActiveSupport::Date # I've changed TimeWithZone to Date
def as_json(options = {})
strftime('%Y')
end
end
...but it's not working (the date format is unchanged from the default 2011-02-03).
Any hints on how to get this going much appreciated.