Browse Source

[ruby/grape] Use `update_columns` instead of `update` (#8994)

Unlike `update_columns`, `update` runs in a transaction and runs
callbacks. Transactions aren't a requirement, so we can just call
`update_columns` for improved performance.
Petrik de Heus 1 year ago
parent
commit
dc235e3032
1 changed files with 1 additions and 1 deletions
  1. 1 1
      frameworks/Ruby/grape/config.ru

+ 1 - 1
frameworks/Ruby/grape/config.ru

@@ -66,7 +66,7 @@ module Acme
             world = World.find(rand1)
             new_value = rand1
             new_value = rand1 while new_value == world.randomNumber
-            world.update(randomNumber: new_value)
+            world.update_columns(randomNumber: new_value)
             world
           end
         end