rails/rails — pull request #9320 by wangjohn (2013-02-19 01:12:10+00:00)
Title: Raising an ActiveRecordError when one tries to use touch on a new record object

This is in response to https://github.com/rails/rails/issues/8345. It seems like the best course of action is to throw an error when one attempts to touch a new object that has not yet been persisted. For instance:

ball = Ball.new
ball.touch :updated_at

Should not trigger a DB statement at all, but should probably throw an error until the ball object has been persisted. This PR takes care of that (in the same manner that it is done for update_column) and adds a test.