hello_world_controller.rb 391 B

12345678910111213141516
  1. class HelloWorldController < ApplicationController
  2. def json
  3. render :json => {:message => "Hello World!"}
  4. end
  5. def db
  6. queries = (params[:queries] || 1).to_i
  7. results = (1..queries).map do
  8. # get a random row from the database, which we know has 10000
  9. # rows with ids 1 - 10000
  10. World.find(Random.rand(10000) + 1)
  11. end
  12. render :json => results
  13. end
  14. end