From f1cbdec8e778815534690725b38282f81bc9828f Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Mon, 16 Jul 2018 01:06:30 +0300 Subject: [PATCH] Supply PaperTrail with current user --- app/controllers/application_controller.rb | 4 ---- app/controllers/registrant/sessions_controller.rb | 4 ++++ app/controllers/registrant_controller.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 518b752b7..dec34acbf 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -32,8 +32,4 @@ class ApplicationController < ActionController::Base def available_languages { en: 'English', et: 'Estonian' }.invert end - - def user_for_paper_trail - current_user.present? ? current_user.id_role_username : 'public' - end end \ No newline at end of file diff --git a/app/controllers/registrant/sessions_controller.rb b/app/controllers/registrant/sessions_controller.rb index 38efe9406..6dabd8e8c 100644 --- a/app/controllers/registrant/sessions_controller.rb +++ b/app/controllers/registrant/sessions_controller.rb @@ -105,4 +105,8 @@ class Registrant::SessionsController < Devise::SessionsController def after_sign_out_path_for(_resource_or_scope) new_registrant_user_session_path end + + def user_for_paper_trail + current_registrant_user.present? ? current_registrant_user.id_role_username : 'guest' + end end \ No newline at end of file diff --git a/app/controllers/registrant_controller.rb b/app/controllers/registrant_controller.rb index 76be97a1f..2d5d3f0d7 100644 --- a/app/controllers/registrant_controller.rb +++ b/app/controllers/registrant_controller.rb @@ -17,6 +17,6 @@ class RegistrantController < ApplicationController end def user_for_paper_trail - current_registrant_user.present? ? current_registrant_user.id_role_username : 'public' + current_registrant_user.present? ? current_registrant_user.id_role_username : 'guest' end end \ No newline at end of file