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 還沒有評估資料。