Randomize the talks
This commit is contained in:
parent
36c61cc531
commit
e56bd9328d
|
@ -9,4 +9,12 @@ class ApplicationController < ActionController::Base
|
|||
# request.env['HTTP_X_FORWARDED_FOR'] ||
|
||||
request.remote_ip
|
||||
end
|
||||
|
||||
def sort_seed
|
||||
if session[:random_sort_seed].present?
|
||||
session[:random_sort_seed].to_i
|
||||
else
|
||||
session[:random_sort_seed] = Random.new_seed
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class TalkPreferencesController < ApplicationController
|
||||
def index
|
||||
@talks = Talk.all(params: {locale: I18n.locale})
|
||||
@talks = Talk.all(params: {locale: I18n.locale}).to_a.shuffle(random: Random.new(sort_seed))
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
Loading…
Reference in New Issue