Sha256: 0cc10eb02883517474084fd401d0cec8c4b4532cd563d2b2f026600fe2756921
Contents?: true
Size: 822 Bytes
Versions: 5
Compression:
Stored size: 822 Bytes
Contents
module ActiveRecord module AttributeMethods module Read silence_warnings do def read_attribute(attr_name, &block) # CPK if attr_name.kind_of?(Array) || attr_name.to_s == 'id'.freeze && @attributes.key?('id') _read_attribute(attr_name, &block) else name = attr_name.to_s name = self.class.primary_key if name == 'id'.freeze _read_attribute(name, &block) end end def _read_attribute(attr_name) # CPK if attr_name.kind_of?(Array) attr_name.map {|name| @attributes.fetch_value(name.to_s)} else @attributes.fetch_value(attr_name.to_s) { |n| yield n if block_given? } end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems