jsonapi_resource should use relationship.class_name instead of relationship_name
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Bắt đầu với các định nghĩa quan hệ trong issue và theo dõi cách route của tài nguyên liên quan kudos-received chọn controller của nó. So sánh tên quan hệ với class_name và model_name, sau đó quyết định liệu routing mặc định nên sử dụng tên model hay hỗ trợ ghi đè controller ở cấp quan hệ; được xem là hoàn tất khi route được tạo trỏ đến controller mm/kudos dự kiến mà không làm hỏng hành vi hiện có.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
We have models Contractor and Mm::Kudo and corresponding resources.
class ContractorResource < JSONAPI::Resource
model_name 'Coworker'
attributes :name, :uid, :avatar_url
has_many :kudos_given, class_name: 'Mm::Kudo'
end
class Mm::KudoResource < JSONAPI::Resource
model_name 'Mm::Kudo'
attributes :value, :tags, :comment
has_one :giver, class_name: 'Contractor'
end
And generate route for kudos-received relation points to kudos#get_related_resources controller instead of mm/kudos#get_related_resources (btw.: includes work fine)
There two options:
- leave the default behaviour as it is and allow to overwrite controller at relationship level
e.g.: for the given example
has_many :kudos_given, class_name: 'Mm::Kudo', controller: 'mm/kudos'
and pass the relationship params to the jsonapi_related_resources
- use
model_nameto generate path for default controller (and still allow to overwrite controller at thehas_manydefinition
Which option should we pick and adopt
- Ngôn ngữ chính
- Ruby
- Star
- 2.3k
- Fork
- 546
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của JSONAPI-Resources/jsonapi-resources
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
ArgumentError with Rails 8.1 Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 50/100
JSONAPI-Resources/jsonapi-resources#1488 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
JSONAPI-Resources/jsonapi-resources#1479 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
JSONAPI-Resources/jsonapi-resources#1477 · 3 bình luận · 1 reaction ·
-
Fields filtering with include Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
Tất cả issue của JSONAPI-Resources/jsonapi-resources
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
riscv/riscv-unified-db#2626 ·
-
Component: GLib
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
ds-drift
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
we-promise/sure#3693 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
simp/pupmod-simp-simp#395 ·