hyperstack-org / hyperstack-org/hyperstack

has_many through associations initializing incorrectly

オープン
#291 コメント 0 件 リアクション 0 件 担当者 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 を短くまとめたダイジェスト。