class Episode < ApplicationRecord
acts_as_paranoid
before_destroy do
puts self.authors.count
end
has_many :authors, dependent: :destroy
and
class Episode < ApplicationRecord
before_destroy do
puts self.authors.count
end
acts_as_paranoid
has_many :authors, dependent: :destroy
This for me outputs different size of authors. In the first case authors are already destroyed. Because of this I can not do anything with them in the before_destroy.
In the second case the authors are there.
Looking at the code like this I think it should not matter which comes first.
Given
and
This for me outputs different size of authors. In the first case authors are already destroyed. Because of this I can not do anything with them in the before_destroy.
In the second case the authors are there.
Looking at the code like this I think it should not matter which comes first.