Sha256: 103c20afffab270999c2555f2a5131f82ab1ed770ec10750b00f477f4e218ba2
Contents?: true
Size: 439 Bytes
Versions: 9
Compression:
Stored size: 439 Bytes
Contents
module Toy module Cloneable extend ActiveSupport::Concern def initialize_copy(other) instance_variables.each do |name| instance_variable_set(name, nil) end @attributes = {} other.attributes.except('id').each do |key, value| value = value.duplicable? ? value.clone : value send("#{key}=", value) end write_attribute(:id, self.class.next_key(self)) end end end
Version data entries
9 entries across 9 versions & 1 rubygems