PERF: Optimize post editing
Reordering the conditions reduced the execution time by a factor of 5.
This commit is contained in:
parent
67c9940d72
commit
8e27fa1bd8
|
@ -359,7 +359,7 @@ class PostRevisor
|
|||
end
|
||||
|
||||
POST_TRACKED_FIELDS.each do |field|
|
||||
if @fields.has_key?(field) || (should_create_new_version? && field == "edit_reason")
|
||||
if @fields.has_key?(field) || (field == "edit_reason" && should_create_new_version?)
|
||||
@post.public_send("#{field}=", @fields[field])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue