Skip to content

Commit

Permalink
Use updated JR branch which merges records on joins
Browse files Browse the repository at this point in the history
  • Loading branch information
lgebhardt committed Feb 8, 2020
1 parent fba3a64 commit ae0c87f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source 'https://rubygems.org'
gem(
'jsonapi-resources',
git: 'https://github.com/cerebris/jsonapi-resources.git',
branch: 'track_join_options'
branch: 'use_records_for_joined_resources'
)

gemspec
12 changes: 0 additions & 12 deletions lib/jsonapi/authorization/pundit_scoped_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,6 @@ def records(options = {})
user_context = JSONAPI::Authorization.configuration.user_context(options[:context])
::Pundit.policy_scope!(user_context, super)
end

def apply_joins(records, join_manager, options)
records = super
join_manager.join_details.each do |k, v|
next if k == '' || v[:join_type] == :root
v[:join_options][:relationship_details][:resource_klasses].each_key do |klass|
next unless klass.included_modules.include?(PunditScopedResource)
records = records.where(v[:alias] => { klass._primary_key => klass.records(options)})
end
end
records
end
end
end
end
Expand Down

0 comments on commit ae0c87f

Please sign in to comment.