Sha256: 9d6ba242340a3aea1a9464be4ecf4c59c0ccc97e91408c51e8b47d7f1111ae3a
Contents?: true
Size: 854 Bytes
Versions: 6
Compression:
Stored size: 854 Bytes
Contents
class Content < ActiveRecord::Base self.table_name = 'content' has_one :content_position, dependent: :destroy def self.destroyed_ids @destroyed_ids ||= [] end before_destroy do |object| Content.destroyed_ids << object.id end end class ContentWhichRequiresTwoDestroyCalls < ActiveRecord::Base self.table_name = 'content' has_one :content_position, foreign_key: 'content_id', dependent: :destroy after_initialize do @destroy_count = 0 end before_destroy do @destroy_count += 1 if @destroy_count == 1 throw :abort end end end class ContentPosition < ActiveRecord::Base belongs_to :content, dependent: :destroy def self.destroyed_ids @destroyed_ids ||= [] end before_destroy do |object| ContentPosition.destroyed_ids << object.id end end
Version data entries
6 entries across 6 versions & 1 rubygems