Created
August 1, 2016 20:34
-
-
Save igorkasyanchuk/556fd78d479bedc5a142939abc37f9b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return users in random order (but use this order in next request) | |
randomizer = Random.new | |
session[:seed] ||= randomizer.rand(1.0) | |
User.connection.execute "select setseed(#{session[:seed].to_f})" | |
@users = User.order('random()').page(params[:page]).per(24) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment