I have a rails 3 app I've updated to 4.1 and have one failing test left that is driving me crazy. It seems that in rails 4, when you create a datetime with only a date, it adjust the time to the current time zone, but did not in rails 3.
Easier with an example:
Rails 3.2:
obj = Model.new
obj.expiration_date = "2016-07-01"
obj.expiration_date
=> Fri, 01 Jul 2016 00:00:00 UTC +00:00
Rails 4.1
obj = Model.new
obj.expiration_date = "2016-07-01"
obj.expiration_date
=> Fri, 01 Jul 2016 04:00:00 UTC +00:00
Both dates are in UTC, however the timestamps are 4 hours apart.
Does anyone have any suggestions on what might have changed in rails 4 that could cause this?
I Think you need to set default_timezone in application.rb file to your required timezone.