1

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?

Robin Solanki
  • 203
  • 1
  • 8
  • I had a similar issue with this. You can find some information here and the links I posted at the bottom: http://stackoverflow.com/questions/39358259/bootstrap-styled-button-not-being-applied-to-phoenix-delete-link?noredirect=1&lq=1 . What do you get when you run `brunch build`? Is it successful/unsuccessful? Do you mind updating your question to include your `SessionController`? – KA01 Sep 18 '16 at 03:27

1 Answers1

1

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.

amatalai
  • 397
  • 1
  • 9