# ActiveRecord#touch behaviour in Rails 3

**URL:** <https://www.ruby-forum.com/t/activerecord-touch-behaviour-in-rails-3/195380>\
**Category:** Rails\
**Created:** [September 22, 2010, 12:34pm UTC](https://www.ruby-forum.com/t/activerecord-touch-behaviour-in-rails-3/195380 "2010-09-22T12:34:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![coriordan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b5ac83/32.png) [@coriordan](https://www.ruby-forum.com/u/coriordan)\
**Post date:** [September 22, 2010, 12:34pm UTC](https://www.ruby-forum.com/t/activerecord-touch-behaviour-in-rails-3/195380/1 "2010-09-22T12:34:12Z")

</div>

In Rails 2.x, calling touch on an ActiveRecord model would update the  
‘lock\_version’ on the model, if it were present.

It would produce something like this in SQL:

UPDATE `foo` SET `updated_at` = ‘2010-07-23 10:44:19’, `lock\_version’  
= 2 WHERE ‘lock\_version’ = 1

This would ensure that your optimistic locking policy will be followed  
should another concurrent update occur on that row in your database.  
Rails 3 no longer updates the ‘lock\_version’ column through the touch  
method. I preferred the Rails 2 behaviour, I was wondering if anyone  
knew the reasoning behind this change?

Regards,  
C.
