Module: ThrottledTouch

Included in:
Issue, MergeRequest, Note
Defined in:
app/models/concerns/throttled_touch.rb

Overview

ThrottledTouch can be used to throttle the number of updates triggered by calling “touch” on an ActiveRecord model.

Constant Summary collapse

TOUCH_INTERVAL =

The amount of time to wait before “touch” can update a record again.

1.minute

Instance Method Summary collapse

Instance Method Details

#touch(*args) ⇒ Object


9
10
11
# File 'app/models/concerns/throttled_touch.rb', line 9

def touch(*args)
  super if (Time.zone.now - updated_at) > TOUCH_INTERVAL
end