Skip to content
This repository
Browse code

Make sure Model#touch doesn't try to update non existing columns

  • Loading branch information...
commit 573fd39e22b3d278457fa764c107095808b361fe 1 parent eb1e727
Pratik authored December 30, 2010
2  activerecord/lib/active_record/timestamp.rb
@@ -67,7 +67,7 @@ def should_record_timestamps?
67 67
     end
68 68
 
69 69
     def timestamp_attributes_for_update_in_model
70  
-      timestamp_attributes_for_update.select { |c| respond_to?(c) }
  70
+      timestamp_attributes_for_update.select { |c| self.class.column_names.include?(c.to_s) }
71 71
     end
72 72
 
73 73
     def timestamp_attributes_for_update #:nodoc:
4  activerecord/test/models/task.rb
... ...
@@ -1,3 +1,5 @@
1 1
 class Task < ActiveRecord::Base
2  
-
  2
+  def updated_at
  3
+    ending
  4
+  end
3 5
 end

0 notes on commit 573fd39

Please sign in to comment.
Something went wrong with that request. Please try again.