diff --git a/db/seeds.rb b/db/seeds.rb index a52ddda..e8abf04 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -75,7 +75,7 @@ end updated_at = created_at + rand(4..44).minutes status_changed_at = updated_at end - job = Job.new(status:, privacy_policy: true, created_at: created_at) + job = Job.new(status:, privacy_policy: true) job.pdf = File.open(Rails.root.join('db/pdfs/', pdf)) student = students[rand(0..9)] job.customer = student @@ -84,6 +84,7 @@ end job.operator = operator if status != :open job.cashier = operator if status == :paid job.save! + job.update_column :created_at, created_at # write with update_column to avoid before_save action job.update_column :printed_at, printed_at # write with update_column to avoid before_save action job.update_column :status_changed_at, status_changed_at # write with update_column to avoid before_save action job.update_column :paid_at, paid_at if status == :paid # write with update_column to avoid before_save action @@ -109,7 +110,7 @@ end updated_at = created_at + rand(4..44).minutes status_changed_at = updated_at end - job = Job.new(status:, privacy_policy: true, created_at: created_at) + job = Job.new(status:, privacy_policy: true) job.pdf = File.open(Rails.root.join('db/pdfs/', pdf)) student = students[rand(0...9)] job.customer = student @@ -118,6 +119,7 @@ end job.operator = operator if status == :paid job.cashier = operator if status == :paid job.save! + job.update_column :created_at, created_at # write with update_column to avoid before_save action job.update_column :printed_at, printed_at # write with update_column to avoid before_save action job.update_column :status_changed_at, status_changed_at # write with update_column to avoid before_save action job.update_column :paid_at, paid_at if status == :paid # write with update_column to avoid before_save action