diff --git a/lib/jsonapi/resource.rb b/lib/jsonapi/resource.rb
index <HASH>..<HASH> 100644
--- a/lib/jsonapi/resource.rb
+++ b/lib/jsonapi/resource.rb
@@ -537,6 +537,7 @@ module JSONAPI
               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
               order_by_query = "#{associations.last.name}_sorting.#{column_name} #{direction}"
               records = records.joins(joins_query).order(order_by_query)
             else
diff --git a/test/controllers/controller_test.rb b/test/controllers/controller_test.rb
index <HASH>..<HASH> 100644
--- a/test/controllers/controller_test.rb
+++ b/test/controllers/controller_test.rb
@@ -327,8 +327,6 @@ class PostsControllerTest < ActionController::TestCase
     assert_equal post.id.to_s, json_response['data'][-2]['id'], 'alphabetically first user is second last'
   end
 
-  end
-
   def test_invalid_sort_param
     get :index, params: {sort: 'asdfg'}
Add comment for order by query and fix typo