diff --git a/lib/trax/model/mixins/sort_scopes.rb b/lib/trax/model/mixins/sort_scopes.rb
index <HASH>..<HASH> 100644
--- a/lib/trax/model/mixins/sort_scopes.rb
+++ b/lib/trax/model/mixins/sort_scopes.rb
@@ -40,6 +40,7 @@ module Trax
 
           def define_order_by_scope_for_field(field_name, as:field_name, class_name:self.name, prefix:'sort_by', with:nil, **options)
             klass = class_name.is_a?(String) ? class_name.constantize : class_name
+            return unless klass.table_exists?
             column_type = klass.column_types[field_name.to_s].type
 
             case column_type
return unless table_exists? to fix eager loading issue with CI environments