def read_family_attributes(attr_name)
attr_name = attr_name.to_s
column = column_for_attribute(attr_name)
if column
if @attributes.has_key?(attr_name)
if (values = @attributes[attr_name]) and values.is_a?(Hash)
values.delete(self.class.primary_key)
casted_values = {}
values.each{|k,v| casted_values[k] = column.type_cast(v)}
write_attribute(attr_name, casted_values)
else
write_attribute(attr_name, {})
end
elsif !(is_loaded?(attr_name)) and attr_name != self.class.primary_key and !new_record?
unless self.all_attributes_loaded? and attr_name =~ /\A#{self.class.default_family}:/
options = {}
options[:timestamp] = self.updated_at.to_bigrecord_timestamp if self.has_attribute?("#{self.class.default_family}:updated_at") and self.updated_at
values = connection.get_columns(self.class.table_name, self.id, [attr_name], options)
if values
values.delete(self.class.primary_key)
casted_values = {}
values.each do |k,v|
short_name = k.split(":")[1]
casted_values[short_name] = column.type_cast(v) if short_name
set_loaded(k)
write_attribute(k, casted_values[short_name]) if short_name
end
write_attribute(attr_name, casted_values)
else
set_loaded(attr_name)
write_attribute(attr_name, {})
end
else
write_attribute(attr_name, column.default)
end
else
write_attribute(attr_name, column.default)
end
else
nil
end
end