mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
41ffddbc8b
This PR addresses the issue described in #28025. On `dependent: :nullify` strategy only the foreign key of the relation is nullified. However on polymorphic associations the `*_type` column is not nullified leaving the record with a NULL `*_id` but the `*_type` column is present.
14 lines
327 B
Ruby
14 lines
327 B
Ruby
# frozen_string_literal: true
|
|
|
|
class DrinkDesigner < ActiveRecord::Base
|
|
has_one :chef, as: :employable
|
|
end
|
|
|
|
class DrinkDesignerWithPolymorphicDependentNullifyChef < ActiveRecord::Base
|
|
self.table_name = "drink_designers"
|
|
|
|
has_one :chef, as: :employable, dependent: :nullify
|
|
end
|
|
|
|
class MocktailDesigner < DrinkDesigner
|
|
end
|