Skip to content

Instantly share code, notes, and snippets.

@dubilla
Last active August 29, 2015 13:55
Show Gist options
  • Save dubilla/8696915 to your computer and use it in GitHub Desktop.
Save dubilla/8696915 to your computer and use it in GitHub Desktop.
Property.all.each do |property|
property.activity_logs.each do |activity_log|
iterations = activity_log.activity_log_iterations.order('iteration_time desc')
iterations.each_with_index do |iteration, index|
next_iteration = iterations[index+1]
if next_iteration.present?
iteration.update_column(:end_date, next_iteration.iteration_time)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment