lib/getaround_utils/railties/lograge.rb in getaround_utils-0.1.12 vs lib/getaround_utils/railties/lograge.rb in getaround_utils-0.1.13
- old
+ new
@@ -13,11 +13,11 @@
payload[:lograge][:host] = request.host
payload[:lograge][:params] = request.filtered_parameters.except(:action, :controller)
payload[:lograge][:remote_ip] = request.remote_ip
payload[:lograge][:user_agent] = request.user_agent
payload[:lograge][:referer] = request.referer
- payload[:lograge][:controller_action] = "#{params[:controller]}##{params[:action]}" if params
- payload[:lograge][:session_id] = session&.id
+ payload[:lograge][:controller_action] = "#{params[:controller]}##{params[:action]}" if defined?(params)
+ payload[:lograge][:session_id] = session.is_a?(Hash) ? session[:id] : session.id if defined?(session)
payload[:lograge][:user_id] = current_user&.id if defined?(current_user)
end
end
initializer 'getaround_utils.action_controller' do