Could we get a video on passing Devise current_user (or general user roles) into a Turbo partial?
Hi Chris,
I was just wondering if there is any possibility of getting a video or some tips on including Devise current_user data or user roles inside a turbo stream - specifically to show/hide edit and delete links? I've gotten a threaded comment feature working after going through the Real-Time Nested Comments videos, but I can't get the edit/delete links working. In this post, DHH says "Partials used for turbo streaming have to be free of global references, as they’re rendered by the ApplicationRenderer, not within the context of a specific request" and in this closed issue he says "You'll need to make a partial that's not dependent on global state like this to work. You can use client-side show/hide using a stimulus controller instead". I've tried to find ideas on work arounds, and I've seen a few workarounds: this one with CSS and this one using local variables. I've tried adapting both of these approaches to my project, but no dice.