Search code examples
ruby-on-railsactiverecordcallback

when is after_touch callback in rails called


How does after_touch callback work in Rails? Is it called whenever an object is updated or only when a new object is created?


Solution

  • It'll be called only if the object is touched:

    object.touch # after_touch will be called
    

    Here you could find more info.