active_record-updated_at icon indicating copy to clipboard operation
active_record-updated_at copied to clipboard

Update gem to support newer Rails versions

Open aaronkelton opened this issue 2 years ago • 1 comments

I'm on Rails 6.1.7.3. Using this gem, it appears that only update_all is still working:

[9] pry(main)> Appointment.update_all(status: 'Hooked')
DEBUG 2023-04-11 18:40:38 +0000   Appointment Update All (12.3ms)  UPDATE "appointments" SET "status" = $1, "updated_at" = $2  [["status", "Hooked"], ["updated_at", "2023-04-11 18:40:38.171631"]]
=> 37
[10] pry(main)> Appointment.update_all(status: 'Booked')
DEBUG 2023-04-11 18:40:56 +0000   Appointment Update All (12.4ms)  UPDATE "appointments" SET "status" = $1, "updated_at" = $2  [["status", "Booked"], ["updated_at", "2023-04-11 18:40:56.788342"]]
=> 37
[11] pry(main)> ActiveRecord::UpdatedAt.disable { Appointment.update_all(status: 'Hooked') }
DEBUG 2023-04-11 18:41:35 +0000   Appointment Update All (8.7ms)  UPDATE "appointments" SET "status" = $1  [["status", "Hooked"]]
=> 37
[12] pry(main)> ActiveRecord::UpdatedAt.disable { Appointment.update_all(status: 'Booked') }
DEBUG 2023-04-11 18:41:42 +0000   Appointment Update All (13.2ms)  UPDATE "appointments" SET "status" = $1  [["status", "Booked"]]
=> 37

Do you know how much effort it would take to get update_column and update_columns working too?

aaronkelton avatar Apr 11 '23 19:04 aaronkelton

If newrelic is no longer an issue, the prepend way worked on my fork. I wonder if we can just use that now. 🤔

aaronkelton avatar Apr 12 '23 04:04 aaronkelton