Module: Upkeep::Runtime::AttributeObserver
- Defined in:
- lib/upkeep/runtime.rb
Instance Method Summary collapse
Instance Method Details
#_read_attribute(attr_name, &block) ⇒ Object
782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 |
# File 'lib/upkeep/runtime.rb', line 782 def _read_attribute(attr_name, &block) value = super return value unless Observation.recording? id = primary_key_value(attr_name, value) dependency = Dependencies::ActiveRecordAttribute.new( table: self.class.table_name, model: self.class.name, id: id, attribute: attr_name.to_s, scope: id.nil? ? upkeep_fresh_record_scope : nil ) Observation.record_dependency(dependency) value end |