|
@@ -4,13 +4,12 @@ class HelloWorldController < ApplicationController
|
|
end
|
|
end
|
|
|
|
|
|
def db
|
|
def db
|
|
- queries = params[:queries] || 1
|
|
|
|
|
|
+ queries = (params[:queries] || 1).to_i
|
|
|
|
|
|
- results = []
|
|
|
|
- (1..queries.to_i).each do
|
|
|
|
|
|
+ results = (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
|
|
- results << World.find(Random.rand(10000) + 1)
|
|
|
|
|
|
+ World.find(Random.rand(10000) + 1)
|
|
end
|
|
end
|
|
render :json => results
|
|
render :json => results
|
|
end
|
|
end
|