dev said almost 3 years ago on Real-time Comments and Voting :
My project, which is based on the source code from this video. 

Fixed

  • bugs in the Votes model (has_many :votes, dependent: :destroy move to User model ).

Added new feature:

  • The title of the vote button changes depending on user actions: up_vote(down_vote) -> undo_vote -> up_vote(down_vote). Title change usually only for current users (Stimulus controller);
  • Unauthenticated users cannot vote on a comment (Stimulus controller );
  • The user who voted will receive a flash message with information;
  • Added the ability for the author of a comment to delete it (Stimulus controller);
  • Hotwire flash messages (lTailwind style);
  • Autohide and manual closing of Hotwire flash messages (Bootstrap JS and Stimulus controller);
  • Comments counter that changes dynamically after adding/removing objects (broadcasts html).
  • Counter votes, rewritten only on broadcasts HTML parts;
  • Small refactoring code