diff options
author | gbuesing <gbuesing@gmail.com> | 2008-05-18 14:13:47 -0500 |
---|---|---|
committer | gbuesing <gbuesing@gmail.com> | 2008-05-18 14:13:47 -0500 |
commit | c1c1d6c2ea72424dfae0b5ee1991d904dcf0f252 (patch) | |
tree | 70ef1a85d125a1f572a3fa7e657617cd789dea16 /activerecord | |
parent | cee9297c9bd43ca8975dc7ca9b707a6aa94c275d (diff) | |
download | rails-c1c1d6c2ea72424dfae0b5ee1991d904dcf0f252.tar.gz rails-c1c1d6c2ea72424dfae0b5ee1991d904dcf0f252.tar.bz2 rails-c1c1d6c2ea72424dfae0b5ee1991d904dcf0f252.zip |
Adding documentation for time zone features
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index c2604894a8..d753778d52 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -162,6 +162,8 @@ module ActiveRecord evaluate_attribute_method attr_name, "def #{attr_name}; unserialize_attribute('#{attr_name}'); end" end + # Defined for all datetime and timestamp attributes when time_zone_aware_attributes are enabled. + # This enhanced read method automatically converts the UTC time stored in the database to the time zone stored in Time.zone def define_read_method_for_time_zone_conversion(attr_name) method_body = <<-EOV def #{attr_name}(reload = false) @@ -183,6 +185,8 @@ module ActiveRecord evaluate_attribute_method attr_name, "def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end", "#{attr_name}=" end + # Defined for all datetime and timestamp attributes when time_zone_aware_attributes are enabled. + # This enhanced write method will automatically convert the time passed to it to the zone stored in Time.zone. def define_write_method_for_time_zone_conversion(attr_name) method_body = <<-EOV def #{attr_name}=(time) |