lib/db/sync.rb in db-sync-0.0.14 vs lib/db/sync.rb in db-sync-0.0.15

- old
+ new

@@ -42,11 +42,11 @@ def insert_records(table, inserts, commit = true) inserts.each do |record| log << "[#{table}] INSERT #{record}" next unless commit - insert_manager = Arel::InsertManager.new(ActiveRecord::Base) + insert_manager = Arel::InsertManager.new arel_model = Arel::Table.new(table) insert_data = record.map do |key, value| [arel_model[key], value] end @@ -61,11 +61,11 @@ deletes.each do |delete_params| log << "[#{table}] DELETE #{delete_params}" next unless commit - delete_manager = Arel::DeleteManager.new(ActiveRecord::Base) + delete_manager = Arel::DeleteManager.new delete_manager.from(arel_model) delete_data = delete_params.map do |key, value| [arel_model[key].eq(value)] end @@ -80,10 +80,10 @@ updates.each do |update| log << "[#{table}] UPDATE #{update[:key]} with #{update[:changes]}" next unless commit - update_manager = Arel::UpdateManager.new(ActiveRecord::Base) + update_manager = Arel::UpdateManager.new update_key = update[:key].map do |key, value| [arel_model[key].eq(value)] end update_changes = update[:changes].map do |key, value| [arel_model[key], value]