-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: 7.1.1, 7.0.8
-
Component/s: Attributes
-
None
-
Environment:production
If you have a class with STI where the descendant declares a new attribute:
class A ... class B < A field :secondary_description, type: String
And you have a has many
class Something
...
has_many :as
accepts_nested_attributes_for :as
And then you create a form, upon creation, if you do
something = Something.new(allowed_params)
You get an error:
Attempted to set a value for 'secondary_description' which is not allowed on the model A
{{}}
This worked fine in Mongoid 6.0, it seems like the instantiation of the has_manys from params is not creating an in-memory object of type B, but instead, is creating an object of type A{{}}