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.env['HTTP_X_FORWARDED_FOR'] ||
|
||||||
request.remote_ip
|
request.remote_ip
|
||||||
end
|
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
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class TalkPreferencesController < ApplicationController
|
class TalkPreferencesController < ApplicationController
|
||||||
def index
|
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
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
Loading…
Reference in New Issue