diff options
author | wangjohn <wangjohn@mit.edu> | 2013-02-25 01:07:19 -0500 |
---|---|---|
committer | wangjohn <wangjohn@mit.edu> | 2013-02-25 01:07:19 -0500 |
commit | 3edccfb08dfbb8f057682e41d9a75e877f7bd412 (patch) | |
tree | da2a44f97e4770c102bdbec7ab90bbf8d3da7763 /activerecord | |
parent | 3285c76557f1c36aba4de17d3440e16220cd87d8 (diff) | |
download | rails-3edccfb08dfbb8f057682e41d9a75e877f7bd412.tar.gz rails-3edccfb08dfbb8f057682e41d9a75e877f7bd412.tar.bz2 rails-3edccfb08dfbb8f057682e41d9a75e877f7bd412.zip |
Added documentation about how touch now throws an error when one tries
to use it on an unpersisted object.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index 26c11b50a2..3f98d8f217 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -367,6 +367,13 @@ module ActiveRecord # # # triggers @brake.car.touch and @brake.car.corporation.touch # @brake.touch + # + # Note that +touch+ must be used on a persisted object, or else an + # ActiveRecordError will be thrown. For example: + # + # ball = Ball.new + # ball.touch(:updated_at) # => raises ActiveRecordError + # def touch(name = nil) raise ActiveRecordError, "can not touch on a new record object" unless persisted? |