for some reason, the link for the github code did not come up properly
before.
Here’s another try. [email protected]:anexiole/rails-delete-fails-without-
js.git
for some reason, the link for the github code did not come up properly
before.
Here’s another try. [email protected]:anexiole/rails-delete-fails-without-
js.git
If you take a look at the code that your app generates for the index it
looks something like this:
As you can see javascript is needed. In the part you see for the delete
link using data-method, data-confirm, etc. All that relies on
javascript. It goes to show method because it sends a GET request
instead of a DELETE request. So it doesn’t work because YOU have
disabled javascript.
You can use pure HTML to do the same thing by creating your own form
anyway and don’t rely on what Rails provides you. But I don’t know what
are you trying to build. I can think of very few web apps that wouldn’t
use javascript nowadays.
Why are you disabling the javascript to start with?
When I build web apps, accessibility is a factor I consider.
One of the points with accessibility is to have the website still
function when a user accesses it from a browser that does not have
javascript.
For example:
users who do have very old computers and browsers without
javascript (hey, they still provide revenue to your site anyway)
users who are using screen readers (especially blind users)
This is why I turned javascript off to simulate that environment.
I’m quite dissappointed in the sense that rails 3 is now having such
reliance on javascript and there’s no proper fallback for cases when
browsers/devices do not have javascript.
Ok, if I were to do it without javascript, I would have to set up a
form with method=“DELETE” and a button for deletion.
Would there be a better way?
Hello, all,
I observed that resource deletion fails in rails 3 without
javascript turned on.
The ‘destroy’ links use javascript, which is required for them to work. In
order for your site to ‘gracefully degrade’ when javascript is turned
off,
you will have to make changes to the scaffolding.