Skip to content

Instantly share code, notes, and snippets.

@Houdini
Created March 26, 2012 13:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Houdini/2205067 to your computer and use it in GitHub Desktop.
class User < ActiveRecord::Base
self.default_timezone = 'Moscow' # работает на запись
# ...
end
1.8.7 :002 > User.first.act_ts
=> Sat, 20 Mar 2010 07:06:25 UTC +00:00
# нельзя поменять с change
================================
class User < ActiveRecord::Base
self.default_timezone = 'Moscow' # работает на запись
self.time_zone_aware_attributes = false
# ...
end
1.8.7 :002 > User.first.act_ts
Sat, 20 Mar 2010 07:06:25 +0000
# можно поменять с change
==============================
# И на чтение, и на запись работает если установить
# application.rb
config.time_zone = 'Moscow'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment