I'm using rails 4
. I need to have a global datetime format to be set as "%Y-%m-%d %H:%M:%S %z"
i.e. 2015-07-29 02:34:38 +0530
.
I tried to override as_json method which works but when I'm using it with delayed_job
, It's serializing object which converts datetime field into 2015-07-29 02:34:38 UTC
.
class ActiveSupport::TimeWithZone
def as_json(options = {})
strftime('%Y-%m-%d %H:%M:%S %z')
end
end
Will it work if serializable_hash
method overriden globally? If yes, how can I?