Sha256: 0f216f2b3e1abe5155b7c52710aa934ecf27e0a75589ac9a339b23068b2ae811
Contents?: true
Size: 923 Bytes
Versions: 12
Compression:
Stored size: 923 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 # CPK #name = self.class.primary_key if name == 'id'.freeze name = self.class.primary_key if name == 'id'.freeze && !composite? _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
12 entries across 12 versions & 1 rubygems