This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :json do | |
desc 'Export all data to JSON files' | |
task :export => :environment do | |
Rails.application.eager_load! | |
ApplicationRecord.descendants.each do |model| | |
next if model.table_name.nil? || model.table_name == '' | |
begin | |
data = model.all | |
next if data == [] |