hyperstack-org / hyperstack-org/hyperstack

has_many through associations initializing incorrectly

未關閉
#291 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
538
分支
41
PR 合併指標
30 天內沒有已合併 PR

描述

The error first showed up when trying to call a scope on an through association

```ruby
# Organization <=> OrganizationMembership <=> User
Organization.find(1).users.throttle(5)
```

which was throwing the error

```JS
Uncaught error: throttle: undefined method throttle for , parent: - Organization,all,___hyperstack_internal_scoped_find_by,{"id"=>1},*0,users>
```

but only on certain pages!

After some digging, this only happened when the through association was initialized by the through association itself (OrganizationMembership).

What appears to be the problem, is the method `AssocationReflection#add_member`, which is initializing the association collection with the class being the owner (Organization), which it should be the target (User).

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。