File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
ruby/hyper-model/lib/reactive_record/active_record Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -399,18 +399,23 @@ def _react_param_conversion(param, opt = nil)
399399 associations = reflect_on_all_associations
400400
401401 already_processed_keys = Set . new
402- old_param = param . dup
403402
404403 param = param . collect do |key , value |
405404 next if already_processed_keys . include? key
406405
407406 model_name = model_id = nil
408407
408+ # polymorphic association is where the belongs_to side holds the
409+ # id, and the type of the model the id points to
410+
411+ # belongs_to :duplicate_of, class_name: 'Report', required: false
412+ # has_many :duplicates, class_name: 'Report', foreign_key: 'duplicate_of_id'
413+
409414 assoc = associations . detect do |poly_assoc |
410415 if key == poly_assoc . polymorphic_type_attribute
411416 model_name = value
412417 already_processed_keys << poly_assoc . association_foreign_key
413- elsif key == poly_assoc . association_foreign_key && poly_assoc . polymorphic_type_attribute
418+ elsif key == poly_assoc . association_foreign_key # && poly_assoc.polymorphic_type_attribute #poly_assoc.macro != :has_many
414419 model_id = value
415420 already_processed_keys << poly_assoc . polymorphic_type_attribute
416421 end
You can’t perform that action at this time.
0 commit comments