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 @@ -11,34 +11,6 @@ def records(options = {})
11
11
::Pundit . policy_scope! ( user_context , super )
12
12
end
13
13
end
14
-
15
- def records_for ( association_name )
16
- record_or_records = @model . public_send ( association_name )
17
- relationship = fetch_relationship ( association_name )
18
-
19
- case relationship
20
- when JSONAPI ::Relationship ::ToOne
21
- record_or_records
22
- when JSONAPI ::Relationship ::ToMany
23
- user_context = JSONAPI ::Authorization . configuration . user_context ( context )
24
- ::Pundit . policy_scope! ( user_context , record_or_records )
25
- else
26
- raise "Unknown relationship type #{ relationship . inspect } "
27
- end
28
- end
29
-
30
- private
31
-
32
- def fetch_relationship ( association_name )
33
- relationships = self . class . _relationships . select do |_k , v |
34
- v . relation_name ( context : context ) == association_name
35
- end
36
- if relationships . empty?
37
- nil
38
- else
39
- relationships . values . first
40
- end
41
- end
42
14
end
43
15
end
44
16
end
You can’t perform that action at this time.
0 commit comments