hyperstack-org / hyperstack-org/hyperstack
foreign key in has_many broken
- 主要语言
- JavaScript
- 星标
- 538
- 派生
- 41
- PR 合并指标
- 30 天内没有已合并 PR
描述
for example:
```ruby
belongs_to :duplicate_of, class_name: 'Report', required: false
has_many :duplicates, class_name: 'Report', foreign_key: 'duplicate_of_id'
```
breaks because of this code in the `ClassMethods#_react_param_conversion` method:
```ruby
assoc = associations.detect do |poly_assoc|
if key == poly_assoc.polymorphic_type_attribute
model_name = value
already_processed_keys << poly_assoc.association_foreign_key
elsif key == poly_assoc.association_foreign_key
model_id = value
already_processed_keys << poly_assoc.polymorphic_type_attribute
end
end
```
it is treating every relationship with a foreign key as a polymorphic relationship.
Clearly a regression when polymorphic was added
贡献指南
评估
这个 Issue 还没有评估数据。