Module: ActiveRecord::NoTouching
| Relationships & Source Files | |
| Namespace Children | |
|
Modules:
| |
| Extension / Inclusion / Inheritance Descendants | |
|
Included In:
| |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
::ActiveSupport::Concern
|
|
| Defined in: | activerecord/lib/active_record/no_touching.rb |
Class Method Summary
- .klasses private
- .applied_to?(klass) ⇒ Boolean Internal use only
- .apply_to(klass) Internal use only
::ActiveSupport::Concern - Extended
| class_methods | Define class methods from given block. |
| included | Evaluate given block in context of base class, so that you can write class macros here. |
| prepended | Evaluate given block in context of base class, so that you can write class macros here. |
| append_features, prepend_features | |
Instance Attribute Summary
-
#no_touching? ⇒ Boolean
readonly
Returns
trueif the class hasno_touchingset,falseotherwise.
Instance Method Summary
- #touch Internal use only
- #touch_later Internal use only
Class Method Details
.applied_to?(klass) ⇒ Boolean
This method is for internal use only.
# File 'activerecord/lib/active_record/no_touching.rb', line 36
def applied_to?(klass) # :nodoc: klasses.any? { |k| k >= klass } end
.apply_to(klass)
This method is for internal use only.
[ GitHub ]
.klasses (private)
[ GitHub ]# File 'activerecord/lib/active_record/no_touching.rb', line 41
def klasses ActiveSupport::IsolatedExecutionState[:active_record_no_touching_classes] ||= [] end
Instance Attribute Details
#no_touching? ⇒ Boolean (readonly)
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
# File 'activerecord/lib/active_record/no_touching.rb', line 53
def no_touching? NoTouching.applied_to?(self.class) end
Instance Method Details
#touch
This method is for internal use only.
[ GitHub ]
# File 'activerecord/lib/active_record/no_touching.rb', line 61
def touch(*, **) # :nodoc: super unless no_touching? end
#touch_later
This method is for internal use only.
[ GitHub ]
# File 'activerecord/lib/active_record/no_touching.rb', line 57
def touch_later(*) # :nodoc: super unless no_touching? end