File tree Expand file tree Collapse file tree 1 file changed +0
-28
lines changed
lib/jsonapi/authorization Expand file tree Collapse file tree 1 file changed +0
-28
lines changed Original file line number Diff line number Diff line change @@ -13,34 +13,6 @@ def records(options = {})
13
13
::Pundit . policy_scope! ( user_context , super )
14
14
end
15
15
end
16
-
17
- def records_for ( association_name )
18
- record_or_records = @model . public_send ( association_name )
19
- relationship = fetch_relationship ( association_name )
20
-
21
- case relationship
22
- when JSONAPI ::Relationship ::ToOne
23
- record_or_records
24
- when JSONAPI ::Relationship ::ToMany
25
- user_context = JSONAPI ::Authorization . configuration . user_context ( context )
26
- ::Pundit . policy_scope! ( user_context , record_or_records )
27
- else
28
- raise "Unknown relationship type #{ relationship . inspect } "
29
- end
30
- end
31
-
32
- private
33
-
34
- def fetch_relationship ( association_name )
35
- relationships = self . class . _relationships . select do |_k , v |
36
- v . relation_name ( context : context ) == association_name
37
- end
38
- if relationships . empty?
39
- nil
40
- else
41
- relationships . values . first
42
- end
43
- end
44
16
end
45
17
end
46
18
end
You can’t perform that action at this time.
0 commit comments