hyperstack-org / hyperstack-org/hyperstack

has_many through associations initializing incorrectly

Đang mở
#291 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
538
Fork
41
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.