aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-12-30 18:41:53 +0000
committerPratik Naik <pratiknaik@gmail.com>2010-12-30 18:42:18 +0000
commit573fd39e22b3d278457fa764c107095808b361fe (patch)
tree07c719d2c960c82a09eaa856513d7c641add6e6f /activerecord
parenteb1e727544d9719cf0aa4d914c484a83e707b601 (diff)
downloadrails-573fd39e22b3d278457fa764c107095808b361fe.tar.gz
rails-573fd39e22b3d278457fa764c107095808b361fe.tar.bz2
rails-573fd39e22b3d278457fa764c107095808b361fe.zip
Make sure Model#touch doesn't try to update non existing columns
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/timestamp.rb2
-rw-r--r--activerecord/test/models/task.rb4
2 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/timestamp.rb b/activerecord/lib/active_record/timestamp.rb
index 2ecbd906bd..5617adea1f 100644
--- a/activerecord/lib/active_record/timestamp.rb
+++ b/activerecord/lib/active_record/timestamp.rb
@@ -67,7 +67,7 @@ module ActiveRecord
end
def timestamp_attributes_for_update_in_model
- timestamp_attributes_for_update.select { |c| respond_to?(c) }
+ timestamp_attributes_for_update.select { |c| self.class.column_names.include?(c.to_s) }
end
def timestamp_attributes_for_update #:nodoc:
diff --git a/activerecord/test/models/task.rb b/activerecord/test/models/task.rb
index ee0282c79b..e36989dd56 100644
--- a/activerecord/test/models/task.rb
+++ b/activerecord/test/models/task.rb
@@ -1,3 +1,5 @@
class Task < ActiveRecord::Base
-
+ def updated_at
+ ending
+ end
end