Sha256: 3d87f8b714197ed8aa90c977c6d55f0494f3940675a1b9b78412c322de7431dd
Contents?: true
Size: 748 Bytes
Versions: 13
Compression:
Stored size: 748 Bytes
Contents
# Resolve an issue where the wrong sequence name is used when # importing data with Apartment and ActiveRecord::Import. # See: # * https://github.com/zdennis/activerecord-import/issues/233 # * https://github.com/influitive/apartment/issues/508 Rails.application.config.after_initialize do begin Rails.application.eager_load! ActiveRecord::Base.descendants.each do |model| seq_name = model.sequence_name if seq_name.present? tenant, seq_name = seq_name.include?(".") ? seq_name.split(".") : [nil, seq_name] model.sequence_name = seq_name end end rescue PG::ConnectionBad, ActiveRecord::NoDatabaseError, ActiveRecord::ConnectionNotEstablished # no-op if there is no database setup end end
Version data entries
13 entries across 13 versions & 1 rubygems