active_model_archive 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,16 +16,16 @@ namespace :archive do
|
|
16
16
|
model.archiver_type = ENV['FORMAT']
|
17
17
|
end
|
18
18
|
|
19
|
-
logger.info "Dumping to #{filename}"
|
19
|
+
Rails.logger.info "Dumping to #{filename}"
|
20
20
|
count = model.dump!(filename, per_file: per_file) do |object|
|
21
21
|
begin
|
22
|
-
logger.info object.id
|
22
|
+
Rails.logger.info object.id
|
23
23
|
rescue => e
|
24
|
-
logger.error "OBJECT #{object.id} caused dump to fail"
|
24
|
+
Rails.logger.error "OBJECT #{object.id} caused dump to fail"
|
25
25
|
raise e
|
26
26
|
end
|
27
27
|
end
|
28
|
-
logger.info "#{count} records dumped."
|
28
|
+
Rails.logger.info "#{count} records dumped."
|
29
29
|
end
|
30
30
|
|
31
31
|
# == Example:
|
@@ -41,9 +41,9 @@ namespace :archive do
|
|
41
41
|
start = Time.now
|
42
42
|
|
43
43
|
File.open(filename) do |file|
|
44
|
-
logger.info "Restoring from #{file.path}
|
44
|
+
Rails.logger.info "Restoring from #{file.path}, publishing=#{!no_publish}"
|
45
45
|
count = model.each_instance(file) do |record|
|
46
|
-
logger.info "Saving #{record.id}"
|
46
|
+
Rails.logger.info "Saving #{record.id}"
|
47
47
|
record.save(validate: false)
|
48
48
|
unless record.persisted?
|
49
49
|
puts "Error saving record: #{record.inspect}"
|