Skip to content

Commit 4c3c771

Browse files
committed
Add automatic alias tracking to ActiveRelationResourceFinder
* enables related resource filtering * introduces JoinTree to track the required joins for a request to avoid join collisions * simplifies the resource finder, but there's still some room for improvement * makes use of the rails 5 `left_join` method. For rails 4 will require an additional gem to add the functionality. This is tested with the `left_join` gem, though others could exist and work.
1 parent 16ff808 commit 4c3c771

File tree

13 files changed

+596
-280
lines changed

13 files changed

+596
-280
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ when 'master'
1919
when 'default'
2020
gem 'railties', '>= 5.0'
2121
else
22+
gem 'left_join' if version.start_with?('4.2')
2223
gem 'railties', "~> #{version}"
2324
end

lib/jsonapi-resources.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@
2525
require 'jsonapi/callbacks'
2626
require 'jsonapi/link_builder'
2727
require 'jsonapi/active_relation_resource_finder'
28+
require 'jsonapi/active_relation_resource_finder/join_tree'
2829
require 'jsonapi/resource_identity'

0 commit comments

Comments
 (0)