K.M. wrote in post #1024158:
> 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:
<head>
<title>Guitar</title>
<link href="/stylesheets/scaffold.css?1317282309" media="screen"
rel="stylesheet" type="text/css" />
<script src="/javascripts/prototype.js?1317282218"
type="text/javascript"></script>
<script src="/javascripts/effects.js?1317282218"
type="text/javascript"></script>
<script src="/javascripts/dragdrop.js?1317282218"
type="text/javascript"></script>
<script src="/javascripts/controls.js?1317282218"
type="text/javascript"></script>
<script src="/javascripts/rails.js?1317282218"
type="text/javascript"></script>
<script src="/javascripts/application.js?1317282218"
type="text/javascript"></script>
<meta name="csrf-param" content="authenticity_token"/>
<meta name="csrf-token"
content="WF9XbwuCjb8sI6ZkZSI/9Wx/I3X5LswsFjeN5Qd4gIs="/>
</head>
<body>
<h1>Listing guitars</h1>
<table>
<tr>
<th>Name</th>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<td>Ibanez</td>
<td><a href="/guitars/1">Show</a></td>
<td><a href="/guitars/1/edit">Edit</a></td>
<td><a href="/guitars/1" data-confirm="Are you sure?"
data-method="delete" rel="nofollow">Destroy</a></td>
</tr>
</table>
<br />
<a href="/guitars/new">New Guitar</a>
</body>
</html>
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?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.