Skip to content

Commit 7c31a6e

Browse files
committed
Remove obsolete records_for method
This method is no longer used in JR 0.10
1 parent ff64d10 commit 7c31a6e

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

lib/jsonapi/authorization/pundit_scoped_resource.rb

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,6 @@ def records(options = {})
1313
::Pundit.policy_scope!(user_context, super)
1414
end
1515
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
4416
end
4517
end
4618
end

0 commit comments

Comments
 (0)