diff options
Diffstat (limited to 'config/initializers/active_record_array_type_casting.rb')
-rw-r--r-- | config/initializers/active_record_array_type_casting.rb | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/config/initializers/active_record_array_type_casting.rb b/config/initializers/active_record_array_type_casting.rb deleted file mode 100644 index a149e048ee2..00000000000 --- a/config/initializers/active_record_array_type_casting.rb +++ /dev/null @@ -1,23 +0,0 @@ -# Remove this initializer when upgraded to Rails 5.0 -unless Gitlab.rails5? - module ActiveRecord - class PredicateBuilder - class ArrayHandler - module TypeCasting - def call(attribute, value) - # This is necessary because by default ActiveRecord does not respect - # custom type definitions (like our `ShaAttribute`) when providing an - # array in `where`, like in `where(commit_sha: [sha1, sha2, sha3])`. - model = attribute.relation&.engine - type = model.user_provided_columns[attribute.name] if model - value = value.map { |value| type.type_cast_for_database(value) } if type - - super(attribute, value) - end - end - - prepend TypeCasting - end - end - end -end |