Revert `update_columns` -> `update!` when rebaking/post-processing post.

`update!` goes through validation which means old posts that doesn't
adhere to the existing validations will raise an error.
This commit is contained in:
Guo Xiang Tan 2019-04-01 16:29:00 +08:00
parent 2a69ab4a4c
commit 8794d940d3
2 changed files with 2 additions and 2 deletions

View File

@ -32,7 +32,7 @@ module Jobs
# TODO suicide if needed, let's gather a few here first
Rails.logger.warn("Cooked post processor in FATAL state, bypassing. You need to urgently restart sidekiq\norig: #{orig_cooked}\nrecooked: #{recooked}\ncooked: #{cooked}\npost id: #{post.id}")
else
post.update!(cooked: cp.html)
post.update_column(:cooked, cp.html)
extract_links(post)
post.publish_change_to_clients! :revised
end

View File

@ -603,7 +603,7 @@ class Post < ActiveRecord::Base
new_cooked = cook(raw, topic_id: topic_id, invalidate_oneboxes: invalidate_oneboxes)
old_cooked = cooked
self.update!(
update_columns(
cooked: new_cooked,
baked_at: Time.zone.now,
baked_version: BAKED_VERSION