# File lib/dm-core/model.rb, line 435 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 { |property| destination_properties.include?(property) } repository(destination) do all(query.merge(:repository => source)).map do |resource| create(fields.map { |property| [ property.name, property.get(resource) ] }.to_hash) end end end