Pretender button in MADMIN
custombusinesssystems opened this issue · comments
custombusinesssystems commented
Hi Chris,
I am using the rails 7 with jumpstart, and have installed madmin
I wanted to implement pretender and found that you had already done all the ground work
I can't find the a button to impersonate a user on the madmin/users/show or index page so i tried to implement one but i get errors.
if I add the button like so:
<%= link_to "Login As", resource.impersonate_user_path(@record.id), method: :post %>
I get
undefined method `impersonate_user_path' for UserResource:Class
If I add the button without the resource, i get undefined method `impersonate_user_path' for #ActionView::Base:0x0000000002b2f0
<%#= link_to "Login As", impersonate_user_path(resource), method: :post %>
<%= link_to "Edit", resource.edit_path(@record), class: "block bg-white hover:bg-gray-100 text-gray-800 font-semibold py-2 px-4 border border-gray-400 rounded shadow" %>
</div>
<%= button_to "Delete", resource.show_path(@record), method: :delete, data: { confirm: "Are you sure?" }, class: "bg-white hover:bg-gray-100 text-red-500 font-semibold py-2 px-4 border border-red-500 rounded shadow pointer-cursor" %>
Could you point me in the right direction here.