Delete related exercise collection items when deleting exercises or collections

This commit is contained in:
Maximilian Grundke
2018-08-22 13:47:27 +02:00
parent 11dc48dc96
commit b5c3ce2113
2 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
class ExerciseCollection < ActiveRecord::Base
include TimeHelper
has_many :exercise_collection_items
has_many :exercise_collection_items, dependent: :delete_all
alias_method :items, :exercise_collection_items
has_many :exercises, through: :exercise_collection_items, inverse_of: :exercise_collections
belongs_to :user, polymorphic: true