-
-
Save saturday/ffc89e4fd5ad7afe5a9c7971cc2dd080 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.save_recurring_tasks(tasks) | |
transaction = ActiveRecord::Base.transaction do | |
tasks.each_with_index do |task, index| | |
if index == 0 | |
base_id = nil | |
end | |
task.base_task_id = base_id | |
task.save | |
if index == 0 | |
base_id = task.id | |
end | |
end | |
end | |
transaction | |
end |
adam12
commented
Jun 18, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment