hyperstack-org / hyperstack-org/hyperstack
foreign key in has_many broken
- Linguagem predominante
- JavaScript
- Estrelas
- 538
- Forks
- 41
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.