instance method
_read_attribute
Ruby on Rails 6.0.6
Since v3.0.20 Last seen in v6.1.7.10Signature
_read_attribute(attr_name, &block)
This method exists to avoid the expensive primary_key check internally, without breaking compatibility with the read_attribute API
Parameters
-
attr_namereq -
blockblock
Source
# File activerecord/lib/active_record/attribute_methods/read.rb, line 37
def _read_attribute(attr_name, &block) # :nodoc
sync_with_transaction_state if @transaction_state&.finalized?
@attributes.fetch_value(attr_name.to_s, &block)
end
Defined in activerecord/lib/active_record/attribute_methods/read.rb line 37
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::AttributeMethods::Read