lib/syncify/sync.rb in syncify-0.1.3 vs lib/syncify/sync.rb in syncify-0.1.4
- old
+ new
@@ -24,13 +24,19 @@
callback.call(identified_records) if callback.present?
sync_records
end
+ private
+
+ def print_status
+ print "\rIdentified #{identified_records.size} records..."
+ end
+
def identify_associated_records(root, associations)
- print '.'
identified_records << root
+ print_status
standard_associations = associations.reject(&method(:includes_polymorphic_association))
polymorphic_associations = associations.select(&method(:includes_polymorphic_association))
standard_associations.each do |association|
@@ -62,9 +68,10 @@
def traverse_associations(records, associations)
records = Array(records)
identified_records.merge records
+ print_status
records.each do |record|
associations.each do |association, nested_associations|
traverse_associations(record.__send__(association), nested_associations)
end