lib/base_repo.rb
# Transform integer array values in a hash to pg_arrays.
# Any values not of type Array are returned unchanged.
#
# Note: this will not work unless all arrays are of the same type.
# - use :integer or :text.
#
# e.g. If input parameters include a collection of ids to be stored
# in an array column in the database, passing the params through
# this method will prepare the ids correctly for persisting.
#
# @param args [hash,Dry::Validation::Result] the hash or Dry::Validation result.
# @param array_type [Symbol] the type of array (:integer / :text). Default is :integer.
# @return [hash] the transformed hash.
Transform integer array values in a hash to pg_arrays.
Any values not of type Array are returned unchanged.

this will not work unless all arrays are of the same type.
use :integer or :text.


Transform integer array values in a hash to pg_arrays . Any values not of type Array are returned unchanged . this will not work unless all arrays are of the same type . use : integer or : text .
def prepare_array_values_for_db(args, array_type: :integer)
    return nil if args.nil?
    args.to_h.transform_values { |v| v.is_a?(Array) ? array_for_db_col(v, array_type: array_type) : v }
  end
def prepare_array_values_for_db ( args , array_type : :integer ) return nil if args . nil? args . to_h . transform_values { | v | v . is_a? ( Array ) ? array_for_db_col ( v , array_type : array_type ) : v } end
Transform integer array values in a hash to pg_arrays.
Transform integer array values in a hash to pg_arrays .
the transformed hash.
the transformed hash .
hash
args
the hash or Dry::Validation result.
the hash or Dry :: Validation result .
array_type
the type of array (:integer / :text). Default is :integer.
the type of array ( : integer / : text ) . Default is : integer .