aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/no_touching.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/no_touching.rb')
-rw-r--r--activerecord/lib/active_record/no_touching.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/no_touching.rb b/activerecord/lib/active_record/no_touching.rb
index 4059020e25..697076bdae 100644
--- a/activerecord/lib/active_record/no_touching.rb
+++ b/activerecord/lib/active_record/no_touching.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
module ActiveRecord
# = Active Record No Touching
module NoTouching
extend ActiveSupport::Concern
module ClassMethods
- # Lets you selectively disable calls to `touch` for the
+ # Lets you selectively disable calls to +touch+ for the
# duration of a block.
#
# ==== Examples
@@ -41,6 +43,13 @@ module ActiveRecord
end
end
+ # Returns +true+ if the class has +no_touching+ set, +false+ otherwise.
+ #
+ # Project.no_touching do
+ # Project.first.no_touching? # true
+ # Message.first.no_touching? # false
+ # end
+ #
def no_touching?
NoTouching.applied_to?(self.class)
end