操作记录记录显示调整,不存在用户仅显示id
This commit is contained in:
parent
6574aff205
commit
6924366e02
|
@ -40,10 +40,11 @@ class UserAction < ApplicationRecord
|
|||
end
|
||||
|
||||
def opt_user_name
|
||||
if user&.id == user_id
|
||||
"--"
|
||||
user = User.find_by(id: self.user_id)
|
||||
if user.present?
|
||||
user&.login
|
||||
else
|
||||
User.find_by(id: self.user_id)&.login
|
||||
"不存用户:#{action_id}"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<td><%= action.action_name %></td>
|
||||
<td>
|
||||
<%= link_to "/#{action.user&.login}", target: '_blank' do %>
|
||||
<%= overflow_hidden_span action.user&.login, width: 100 %>
|
||||
<%= overflow_hidden_span action.opt_user_name, width: 100 %>
|
||||
<% end %></td>
|
||||
<td>
|
||||
<%= raw action.action_info %>
|
||||
|
|
Loading…
Reference in New Issue