<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>activerecord/test/cases/timestamp_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,8 @@
+*Edge*
+
+* Added ActiveRecord::Base#touch to update the updated_at/on attributes with the current time [DHH]
+
+
 *2.3.2 [Final] (March 15, 2009)*
 
 * Added ActiveRecord::Base.find_each and ActiveRecord::Base.find_in_batches for batch processing [DHH/Jamis Buck]</diff>
      <filename>activerecord/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -15,27 +15,47 @@ module ActiveRecord
       base.class_inheritable_accessor :record_timestamps, :instance_writer =&gt; false
       base.record_timestamps = true
     end
+    
+    # Saves the record with the updated_at/on attributes set to the current time.
+    # If the save fails because of validation errors, an ActiveRecord::RecordInvalid exception is raised.
+    def touch
+      current_time = current_time_from_proper_timezone
+
+      write_attribute('updated_at', current_time) if respond_to?(:updated_at)
+      write_attribute('updated_on', current_time) if respond_to?(:updated_on)
+
+      save!
+    end
+
 
     private
       def create_with_timestamps #:nodoc:
         if record_timestamps
-          t = self.class.default_timezone == :utc ? Time.now.utc : Time.now
-          write_attribute('created_at', t) if respond_to?(:created_at) &amp;&amp; created_at.nil?
-          write_attribute('created_on', t) if respond_to?(:created_on) &amp;&amp; created_on.nil?
+          current_time = current_time_from_proper_timezone
+
+          write_attribute('created_at', current_time) if respond_to?(:created_at) &amp;&amp; created_at.nil?
+          write_attribute('created_on', current_time) if respond_to?(:created_on) &amp;&amp; created_on.nil?
 
-          write_attribute('updated_at', t) if respond_to?(:updated_at) &amp;&amp; updated_at.nil?
-          write_attribute('updated_on', t) if respond_to?(:updated_on) &amp;&amp; updated_on.nil?
+          write_attribute('updated_at', current_time) if respond_to?(:updated_at) &amp;&amp; updated_at.nil?
+          write_attribute('updated_on', current_time) if respond_to?(:updated_on) &amp;&amp; updated_on.nil?
         end
+
         create_without_timestamps
       end
 
       def update_with_timestamps(*args) #:nodoc:
         if record_timestamps &amp;&amp; (!partial_updates? || changed?)
-          t = self.class.default_timezone == :utc ? Time.now.utc : Time.now
-          write_attribute('updated_at', t) if respond_to?(:updated_at)
-          write_attribute('updated_on', t) if respond_to?(:updated_on)
+          current_time = current_time_from_proper_timezone
+
+          write_attribute('updated_at', current_time) if respond_to?(:updated_at)
+          write_attribute('updated_on', current_time) if respond_to?(:updated_on)
         end
+
         update_without_timestamps(*args)
       end
+      
+      def current_time_from_proper_timezone
+        self.class.default_timezone == :utc ? Time.now.utc : Time.now
+      end
   end
-end
+end
\ No newline at end of file</diff>
      <filename>activerecord/lib/active_record/timestamp.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b49027e188466e55179f737906590a5feb8fea95</id>
    </parent>
  </parents>
  <author>
    <name>David Heinemeier Hansson</name>
    <email>david@loudthinking.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/fdb61f02c54bda0ad5ff6d0259209113202b9307</url>
  <id>fdb61f02c54bda0ad5ff6d0259209113202b9307</id>
  <committed-date>2009-04-16T14:48:37-07:00</committed-date>
  <authored-date>2009-04-16T14:48:07-07:00</authored-date>
  <message>Added ActiveRecord::Base#touch to update the updated_at/on attributes with the current time [DHH]</message>
  <tree>1e0c40ed0e6d16a2eea7b0f8642370c89e69adef</tree>
  <committer>
    <name>David Heinemeier Hansson</name>
    <email>david@loudthinking.com</email>
  </committer>
</commit>
