Browse Source

Fix rails update attribute syntax, include ids (#2658)

* In Ruby/rails, fix the syntax for the world.update_attribute call

* In Ruby/rails, include ids in the output of the update test

Without this, the rendered JSON output includes id:null entries, making
it fail the test.
Michael Hixson 8 years ago
parent
commit
5a46d3ad65
1 changed files with 2 additions and 2 deletions
  1. 2 2
      frameworks/Ruby/rails/app/controllers/hello_world_controller.rb

+ 2 - 2
frameworks/Ruby/rails/app/controllers/hello_world_controller.rb

@@ -37,8 +37,8 @@ class HelloWorldController < ApplicationController
     worlds = (1..queries).map do
     worlds = (1..queries).map do
       # get a random row from the database, which we know has 10000
       # get a random row from the database, which we know has 10000
       # rows with ids 1 - 10000
       # rows with ids 1 - 10000
-      world = World.select(:randomNumber).find(Random.rand(10000) + 1)
-      world.update_attribute(:randomNumber => Random.rand(10000) + 1)
+      world = World.select(:id, :randomNumber).find(Random.rand(10000) + 1)
+      world.update_attribute(:randomNumber, Random.rand(10000) + 1)
       world
       world
     end
     end