Skip to content

Commit

Permalink
Remove redundant after_destroy callback (#640)
Browse files Browse the repository at this point in the history
  • Loading branch information
fosterfarrell9 authored May 28, 2024
1 parent 77040f6 commit 35912c5
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions app/models/medium.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ class Medium < ApplicationRecord
after_create :create_self_item
# if medium is a question or remark, delete all quiz vertices that refer to it
before_destroy :delete_vertices
# if medium is a question, delete all answers that belong to it
after_destroy :delete_answers
# some information about media are cached
# to find out whether the cache is out of date, always touch'em after saving
after_save :touch_teachable
Expand Down Expand Up @@ -1242,12 +1240,6 @@ def delete_vertices
becomes(Remark).delete_vertices
end

def delete_answers
return unless type == "Question"

becomes(Question).answers.delete_all
end

def text_join
return unless type.in?(["Question", "Remark"])
return text if type == "Remark"
Expand Down

0 comments on commit 35912c5

Please sign in to comment.