Sha256: c59b5c2444189e4c725e3324e26391d39b3eeb432b914df57f990abe270e2edd
Contents?: true
Size: 1009 Bytes
Versions: 1
Compression:
Stored size: 1009 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 next unless defined?(Apartment) # Apartment already solves this issue (and in a better way) in newer versions begin require('apartment/version') next if Gem::Version.new(Apartment::VERSION) >= Gem::Version.new('2.8.1') rescue LoadError end 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
canvas_sync-0.17.23.beta5 | config/initializers/apartment.rb |