Skip to content

Instantly share code, notes, and snippets.

View synth's full-sized avatar

Peter Philips synth

View GitHub Profile
Rails.application.eager_load!
exclude_tables = ["sessions"]
row_limit_per_table = nil
tables = []
ApplicationRecord.descendants.each do |model|
next if exclude_tables.any?{ |skip_table| skip_table == model.table_name }
next if tables.include?(model.table_name) # This covers STI
puts "Exporting: #{model.table_name}"