1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/models/drink_designer.rb
Laerti 41ffddbc8b Refs #28025 nullify *_type column on polymorphic associations on :nu… (#28078)
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.
2019-01-15 23:03:20 +09:00

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