Sha256: 318be9173a96c9781527cc202dfcba59dc71b7f2bf1f5464ea763025e387f0da
Contents?: true
Size: 708 Bytes
Versions: 65
Compression:
Stored size: 708 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 # no-op if there is no database setup end end
Version data entries
65 entries across 65 versions & 1 rubygems