diff options
Diffstat (limited to 'config/initializers/active_record_build_select.rb')
-rw-r--r-- | config/initializers/active_record_build_select.rb | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/config/initializers/active_record_build_select.rb b/config/initializers/active_record_build_select.rb deleted file mode 100644 index ab5a872cac6..00000000000 --- a/config/initializers/active_record_build_select.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -# rubocop:disable Gitlab/ModuleWithInstanceVariables - -# build_select only selects the required fields if the model has ignored_columns. -# This is incompatible with some migrations or background migration specs because -# rails keeps a statement cache in memory. So if a model with ignored_columns in a -# migration is used, the query with select table.col1, table.col2 is stored in the -# statement cache. If a different migration is then run and one of these columns is -# removed in the meantime, the query is invalid. - -module ActiveRecord - module QueryMethods - private - - def build_select(arel) - if select_values.any? - arel.project(*arel_columns(select_values.uniq)) - else - arel.project(@klass.arel_table[Arel.star]) - end - end - end -end |