# File lib/dm-core/model.rb, line 325 def copy(source, destination, query = {}) # get the list of properties that exist in the source and destination destination_properties = properties(destination) fields = query[:fields] ||= properties(source).select { |p| destination_properties.has_property?(p.name) } repository(destination) do all(query.merge(:repository => repository(source))).map do |resource| create(fields.map { |p| [ p.name, p.get(resource) ] }.to_hash) end end end