Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

History pages always display "Unknown" for whodunnit #389

Open
werebus opened this issue Mar 25, 2024 · 1 comment
Open

History pages always display "Unknown" for whodunnit #389

werebus opened this issue Mar 25, 2024 · 1 comment
Labels

Comments

@werebus
Copy link
Member

werebus commented Mar 25, 2024

%td= User.find_by(id: version.whodunnit).try(:name) || 'Unknown'

%td= User.find_by(id: version.whodunnit).try(:name) || 'Unknown'

User.find('4').try(:name)
#=> nil
# Hmmm...
User.find('4')&.name
# `method_missing': undefined method `name' for #<User id: 4, ...

All user "names" are nil, because users don't have "names".

@werebus werebus added the bug label Mar 25, 2024
@werebus
Copy link
Member Author

werebus commented Mar 25, 2024

Likewise when the user is changed:

= User.find_by(id: value).try(:name)

= User.find_by(id: value).try(:name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant