aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorMichael Munroe <mike@mikemunroe.com>2018-06-25 21:26:42 -0400
committerMichael Munroe <mike@mikemunroe.com>2018-06-25 21:26:42 -0400
commit13e00df17999857013983051da26a0e15d6f23a5 (patch)
tree41660229019f88fcd838681576bb15f2ce694fb6 /activerecord/lib
parent56b9d0fd3a281f97463edf556d0f4b6b283d715d (diff)
downloadrails-13e00df17999857013983051da26a0e15d6f23a5.tar.gz
rails-13e00df17999857013983051da26a0e15d6f23a5.tar.bz2
rails-13e00df17999857013983051da26a0e15d6f23a5.zip
Add example for no_touching? in active_record/no_touching for api docs [ci skip]
There was no example code for ActiveRecord::NoTouching#no_touching?. This PR adds an example for the API docs.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/no_touching.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/no_touching.rb b/activerecord/lib/active_record/no_touching.rb
index 754c891884..697076bdae 100644
--- a/activerecord/lib/active_record/no_touching.rb
+++ b/activerecord/lib/active_record/no_touching.rb
@@ -43,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