diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 85da787..d00fd5e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/controllers/talk_preferences_controller.rb b/app/controllers/talk_preferences_controller.rb index 8a9c48c..aed5e4e 100644 --- a/app/controllers/talk_preferences_controller.rb +++ b/app/controllers/talk_preferences_controller.rb @@ -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