Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/jsonapi/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ def apply_sort(records, order_options, _context = {})
associations = _lookup_association_chain([records.model.to_s, *model_names])
joins_query = _build_joins([records.model, *associations])

# _sorting is appended to avoid name clashes with manual joins eg. overriden filters
# _sorting is appended to avoid name clashes with manual joins eg. overridden filters
order_by_query = "#{associations.last.name}_sorting.#{column_name} #{direction}"
records = records.joins(joins_query).order(order_by_query)
else
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2488,7 +2488,7 @@ def test_destroy_relationship_has_and_belongs_to_many
JSONAPI.configuration.use_relationship_reflection = false
end

def test_destroy_relationship_has_and_belongs_to_many_refect
def test_destroy_relationship_has_and_belongs_to_many_reflect
JSONAPI.configuration.use_relationship_reflection = true

assert_equal 2, Book.find(2).authors.count
Expand Down