URL: https://linuxfr.org/suivi/commentaire-d-un-compte-supprime-non-editable-par-un-admin Title: Commentaire d'un compte supprimé non éditable par un admin Authors: Benoît Sibaud Date: 2020年06月14日T17:28:25+02:00 License: CC By-SA Tags: Score: 1 Dans app/models/comment.rb ```ruby def wikify_body nofollow = user.account.karma < 50 self.body = wikify(wiki_body, nofollow: nofollow) end ``` du coup toute édition (y compris par un admin) d'un commentaire appartenant à un compte supprimé (entrée dans _accounts_ supprimée mais entrée encore présente dans _users_) échoue : ``` Completed 500 Internal Server Error in 16ms (ActiveRecord: 1.7ms) NoMethodError (undefined method `karma' for nil:NilClass): app/models/comment.rb:42:in `wikify_body' app/controllers/comments_controller.rb:64:in `update' ``` A priori s'il n'y a plus de compte OU si le compte existe avec un karma < 50, on peut place un _nofollow_.

AltStyle によって変換されたページ (->オリジナル) /