hyperstack-org / hyperstack-org/hyperstack

assignment to has_many through relationship does not work

Đang mở
#213 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug discussion
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ả

For example `physician.patients = [patient1, patient2, patient3]` does not work (assuming `patients` is a `has_many :through` relationship through an appointments table.

The problem is that updating patients, implies removal of any existing records in the appointments table, *and* creation of new appointments. In fact we have to investigate what rails does if for example some appointments for a patient already exist.

At any rate it involves several operations take place.

A simplistic approach be to loop through and delete any existing records, THEN to loop through pushing the new records on.

This might be sufficient for a work around, with perhaps a warning.

A better approach might be to have a separate operation, that makes a single call to the server, the update the relationship. This has the advantage of insuring it follows rails semantics.

A third approach would be to just disallow this method, with an error message.

Input needed!

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.