Changeset 788
- Timestamp:
- 02/24/05 12:00:42 (4 years ago)
- Files:
-
- trunk/activerecord/CHANGELOG (modified) (1 diff)
- trunk/activerecord/lib/active_record/timestamp.rb (modified) (3 diffs)
- trunk/activerecord/test/base_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r768 r788 1 1 *SVN* 2 3 * Changed the auto-timestamping feature to use ActiveRecord::Base.default_timezone instead of entertaining the parallel ActiveRecord::Base.timestamps_gmt method. The latter is now deprecated and will throw a warning on use (but still work) #710 [Jamis Buck] 2 4 3 5 * Added a OCI8-based Oracle adapter that has been verified to work with Oracle 8 and 9 #629 [Graham Jenkins]. Usage notes: trunk/activerecord/lib/active_record/timestamp.rb
r773 r788 20 20 21 21 def create_with_timestamps #:nodoc: 22 t = timestamps_gmt ? Time.now.gmtime : Time.now22 t = ( self.class.default_timezone == :utc ? Time.now.utc : Time.now ) 23 23 write_attribute("created_at", t) if record_timestamps && respond_to?(:created_at) && created_at.nil? 24 24 write_attribute("created_on", t) if record_timestamps && respond_to?(:created_on) && created_on.nil? … … 31 31 32 32 def update_with_timestamps #:nodoc: 33 t = timestamps_gmt ? Time.now.gmtime : Time.now33 t = ( self.class.default_timezone == :utc ? Time.now.utc : Time.now ) 34 34 write_attribute("updated_at", t) if record_timestamps && respond_to?(:updated_at) 35 35 write_attribute("updated_on", t) if record_timestamps && respond_to?(:updated_on) … … 45 45 @@record_timestamps = true 46 46 cattr_accessor :record_timestamps 47 48 # deprecated: use ActiveRecord::Base.default_timezone instead. 47 49 @@timestamps_gmt = false 48 cattr_accessor :timestamps_gmt 50 def self.timestamps_gmt=( gmt ) #:nodoc: 51 warn "timestamps_gmt= is deprecated. use default_timezone= instead" 52 self.default_timezone = ( gmt ? :utc : :local ) 53 end 54 55 def self.timestamps_gmt #:nodoc: 56 warn "timestamps_gmt is deprecated. use default_timezone instead" 57 self.default_timezone == :utc 58 end 49 59 end 50 60 end trunk/activerecord/test/base_test.rb
r527 r788 710 710 def test_define_attr_method_with_value 711 711 k = Class.new( ActiveRecord::Base ) 712 k. define_attr_method :table_name, "foo"712 k.send(:define_attr_method, :table_name, "foo") 713 713 assert_equal "foo", k.table_name 714 714 end … … 716 716 def test_define_attr_method_with_block 717 717 k = Class.new( ActiveRecord::Base ) 718 k. define_attr_method( :primary_key) { "sys_" + original_primary_key }718 k.send(:define_attr_method, :primary_key) { "sys_" + original_primary_key } 719 719 assert_equal "sys_id", k.primary_key 720 720 end