This project is archived and is in readonly mode.
Collection Associations Build Method Not Supported for STI
-
x37v
This works nicely for
parent.collection.build(:type => ClassName)but it breaksparent.collection.create(:type => ClassName)
the parent_id isn't filled in in the created object...I'm not sure why because the original source for build_association is very simple and there is also a create_association which i assume would be called for the collection.create approach..
-
x37v
well, besides the fact that the type field is filled in with a class instead of a string.. i figure it should do h.symbolize_keys[col] = type.to_s
-
Marc-André Lafortune
Got bitten by this. A solution for this problem would be nice.
-
Coutud
Encoutered the same issue here, and the given patch seems to be working. I'd remove the && type.class == Class, and would use ActiveRecord::Base.compute_type(options.first[col]) instead of .constantize