Skip to content

Delete a BountyClaim

Cory Boyd edited this page May 30, 2014 · 2 revisions

Delete a bounty claim

issue = Issue.find(821015)
bounty_claim = issue.bounty_claims.find(301)
  1. Delete events

    # Gross relation name
    bounty_claim.bounty_claim_events.each(&:delete)
  2. Delete responses

    bounty_claim.bounty_claim_responses.each(&:delete)
  3. Delete Transaction if bounty claim was collected

    # Find the bounty claim payout transaction and delete
    transaction = Transaction.find(123456)
    transaction.delete

    Then you need to update the bounty total of the Issue

    issue.update_bounty_total
  4. Update Issue paid out flag if necessary

    if bounty_claim.collected? && issue.paid_out?
      issue.update_attribute(:paid_out, false)
    end
  5. KILL IT WITH FIRE

    bounty_claim.delete

Clone this wiki locally