Skip to content

Instantly share code, notes, and snippets.

@johnnaegle
Created April 8, 2014 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnnaegle/10087469 to your computer and use it in GitHub Desktop.
Save johnnaegle/10087469 to your computer and use it in GitHub Desktop.
Monkey Patches ActiveSupport::TimeWithZone for Rails 4.0 to be backwards compatible with Rails 3.2
module ActiveSupport
class TimeWithZone
def as_json(options = nil)
if ActiveSupport::JSON::Encoding.use_standard_json_time_format
xmlschema
else
%(#{time.strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)})
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment