rails / jquery-ujs

Ruby on Rails unobtrusive scripting adapter for jQuery
MIT License
2.61k stars 507 forks source link

Route Resources and Confirmation dialogs #479

Closed cpanderson closed 7 years ago

cpanderson commented 7 years ago

Hello,

I'm having trouble with the confirm dialog (data-confirm) for a delete method. I have...

resources :users

..in my routes file. I have an edit action/view and an index action/view. If I put the link on the my index page...

link_to user_path(user), method: :delete, data: {confirm: 'Are you sure you want to delete this user?'}

...I get a dialog box to Ok or Cancel. If I press Cancel I'm redirected to the edit page instead of the dialog just closing.

Any insight as to why Cancel needs to redirect and how to fix it would be appreciated.

cpanderson commented 7 years ago

Ugh. Nevermind. My bad.