diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 665b2c4..2ee29cf 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -65,7 +65,11 @@ class ApplicationController < ActionController::Base end def user_for_paper_trail - current_user.to_paper_trail rescue 'Public' + if user_signed_in? + current_user.to_paper_trail + else + "Public ip:#{client_remote_ip}" + end end end diff --git a/app/models/user.rb b/app/models/user.rb index 55aa2fd..a16f470 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,9 +2,11 @@ class User < ActiveRecord::Base include SentientModel model_stamper stampable - has_paper_trail ignore: [ :sign_in_count, + has_paper_trail ignore: [ + :updated_at, :sign_in_count, :last_sign_in_at, :current_sign_in_at, - :last_sign_in_ip, :current_sign_in_ip ] + :last_sign_in_ip, :current_sign_in_ip + ] # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :timeoutable and :omniauthable