I have a link to delete the session for the current user
<%= link "Logout", to: session_path(@conn, :delete, current_user.id), method: :delete, class: "button alert" %>
For some reason it doesn't work although when I changed the link to a button everything seems to be working fine.
<%= button "Logout", to: session_path(@conn, :delete, current_user.id), method: :delete, class: "button alert" %>
I am confused for might be the reason causing this error.
Anyone who faced the same issue?
It's only my guess, but according to docs:
:method
- the method to use with the link. In case the method is not:get
, the link is generated inside the form which sets the proper information. In order to submit the form, JavaScript must be enabled
Maybe there is something wrong with javascript in your project.
This would explain why button is actually working:
Generates a button that uses a regular HTML form to submit to the given URL.