Skip to content

Instantly share code, notes, and snippets.

@plainprogrammer
Created August 29, 2017 17:20
Show Gist options
  • Save plainprogrammer/3faeab94b0dd5b09eb8a2ef48af2ba45 to your computer and use it in GitHub Desktop.
Save plainprogrammer/3faeab94b0dd5b09eb8a2ef48af2ba45 to your computer and use it in GitHub Desktop.
class Task < ActiveRecord::Base
has_many :task_actions
has_many :feed_items
def reset
update started_at: DateTime.now, completed_at: nil, failed_at: nil
task_actions.destroy_all
feed_items.each &:reset_completed
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment