diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-02-25 02:36:55 -0800 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-02-25 02:36:55 -0800 |
commit | 82c361e1462d714a076e0033398c393d0048d649 (patch) | |
tree | 2db86c4d0d4f4450357553f927fb515e9560a5ad /activerecord | |
parent | d5141f208e10378ebe3195fa7a9ff523a1296461 (diff) | |
parent | 3edccfb08dfbb8f057682e41d9a75e877f7bd412 (diff) | |
download | rails-82c361e1462d714a076e0033398c393d0048d649.tar.gz rails-82c361e1462d714a076e0033398c393d0048d649.tar.bz2 rails-82c361e1462d714a076e0033398c393d0048d649.zip |
Merge pull request #9409 from wangjohn/adding_documentation_to_touch
Added documentation to touch throwing an error
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 57ae78275d..347f023793 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? |