I’m using rails app as iOS backend. There is small problem – how to render timestamps with user’s timezone in json? I’m using default UTC timezone. How to converted it for example to +2? Maybe there is way how to override as_json method to convert timestamps before rendering?
Thanks for help!
You can convert the time to user’s timezone before rendering json, then the timezone will be included.
UPDATE: To convert the time into user’s timezone for serialization, you can override this method
read_attribute_for_serialization. See lib/active_model/serialization.rb of ActiveModel: