diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-02-24 21:30:54 -0800 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-02-24 21:30:54 -0800 |
commit | 3285c76557f1c36aba4de17d3440e16220cd87d8 (patch) | |
tree | 21e150731afe39e38803ae2339febed32f4f1532 /activerecord/lib | |
parent | 3762ee0baa2285bdc4a76d4d492fbe34a10cdc3a (diff) | |
parent | e52ff809606323f7370cfaf6e63b083f9b108d6c (diff) | |
download | rails-3285c76557f1c36aba4de17d3440e16220cd87d8.tar.gz rails-3285c76557f1c36aba4de17d3440e16220cd87d8.tar.bz2 rails-3285c76557f1c36aba4de17d3440e16220cd87d8.zip |
Merge pull request #9320 from wangjohn/touch_handling_on_new_instances
Raising an ActiveRecordError when one tries to use touch on a new record object
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index 066f93635a..26c11b50a2 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -368,6 +368,8 @@ module ActiveRecord # # triggers @brake.car.touch and @brake.car.corporation.touch # @brake.touch def touch(name = nil) + raise ActiveRecordError, "can not touch on a new record object" unless persisted? + attributes = timestamp_attributes_for_update_in_model attributes << name if name |