lib/active_git/synchronizer.rb in active_git-0.0.5 vs lib/active_git/synchronizer.rb in active_git-0.0.6

- old
+ new

@@ -10,24 +10,23 @@ batch.run end def run - unless bulk_inserts.empty? + if bulk_inserts.any? define_job do bulk_inserts.each do |model, records| ActiveGit.configuration.logger.debug "[ActiveGit] Inserting #{model.model_name} models" import_result = model.import records, timestamps: false, validate: false raise SynchronizationError.new(import_result.failed_instances) unless import_result.failed_instances.empty? end end end ::ActiveRecord::Base.transaction do - jobs.each do |job| - job.call - end + jobs.each(&:call) end + ActiveGit.add_all end def bulk_insert(data) bulk_inserts[data.class] ||= [] unless bulk_inserts.has_key? data.class \ No newline at end of file