Javascript – Rails active_resource require JS to do delete by link_to

activeresourcejavascriptrubyruby-on-rails

When I use link_to :method=>:delete, what rails has generated is a javascript click, which is not nice if you do come across situation your client just have javascript disabled. That seems a bad idea to me. Any chance to get around this?

Best Solution

What it generates is a form with method="delete", your best bet is to make the form yourself, the only thing is that the submit button won't be a link, but a button.

You should not, by any mean, try to do it with a basic <a href="">, because a disruptive action (create, update, delete) should not be made with a GET request.