Sha256: 5905ab26afed5ed15a4741b4c0a03be707453e730002c1167c30dee7a5fe4f1e
Contents?: true
Size: 656 Bytes
Versions: 1
Compression:
Stored size: 656 Bytes
Contents
module ActiveRecord module AttributeMethods module Read def read_attribute(attr_name, &block) # CPK if attr_name.kind_of?(Array) _read_attribute(attr_name, &block) else name = attr_name.to_s name = self.class.primary_key if name == 'id' _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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
composite_primary_keys-8.1.0 | lib/composite_primary_keys/attribute_methods/read.rb |