I'm a bit confused. In a lot of questions on stackoverflow I read you need jquery-ujs to manage your javascript code, especially if you want these destroy links do work. If I go on this page to follow all the installation instructions I must say I have nothing to do.

Because I'm using Rails 3.1 I have to follow this:

For automated installation in Rails, use the "jquery-rails" gem. Place this in your Gemfile:gem 'jquery-rails', '>= 1.0.12'And run:$ bundle installThis next step depends on your version of Rails.

a. For Rails 3.1, add these lines to the top of your app/assets/javascripts/application.js file:

//= require jquery
//= require jquery_ujs

But for Rails 3.1 this is already done after creating a new rails app.

If I run $ rails generate jquery:install I get the following output:

deprecated You are using Rails 3.1 with the asset pipeline enabled, so this generator is not needed.
The necessary files are already in your asset pipeline.
Just add `//= require jquery` and `//= require jquery_ujs` to your app/assets/javascripts/application.js
If you upgraded your app from Rails 3.0 and still have jquery.js, rails.js, or jquery_ujs.js in your javascripts, be sure to remove them.
If you do not want the asset pipeline enabled, you may turn it off in application.rb and re-run this generator.

Okay, nothing new. But why my destroy links still doesn't work. So I ask myself the question where are these jquery files located? When I read the jquery installation instruction for another rails version, there they always tell me to copy these files (jquery.js, jquery-ujs.js) to a specific location. Only as a Ruby 3.1 user you don't have to do this. But why? I can't find these files. Are they a part of the jquery-rails gem? If yes, why my destroy links still doesn't work? Is this really an issue of jquery? I mean if I change the helper from link_to to button_to it's working. So how it can be happen as long as it should be an issue of jquery? It might not matter to me, but I don't want to use a form button. Furthermore I can't believe that an application like Rails contains such a big issue in its common generated templates.

So how to fix this without changing the link_to helper and without going away from javascript (Railscast)?

Usually it should delete a post, but instead the browser is pointed to the location of that post, e.g. http://domain/posts/2.
If you run this with button_to instead of link_to it will work, but then its a form button.

Update 3

Okay, the destroy links work in Firefox, but I'm a Google Chrome user and I want it to work there as well. Is there a solution for this?

But this error occurs on every hyperlink whether it's a destroy link or not.
The destroy link throws an TypeError., but I can't figure out if it comes from jquery.js or from a built in chrome extension. jquery-ujs.js throws the error and the message was "Are you sure?". That's the text defined by rails for a confirm message. So I removed the confirm option and after that the deletion worked.

This answers the only question I could find in your rather long and verbose post. We can't possibly tell you why your destroy links aren't working, since you don't actually say anything more than "they're not working". What happens when you click them? Do you get any javascript errors? Do you get any server-side errors? What do your logs say? There are a ton of debugging steps that you need to perform before we can begin to help you.
–
meagarJan 3 '12 at 5:27

Thanks. I got the files with that path. Know is the question, why the destroy links doesn't work. I did not further explained it, because there are already a lot of these questions here on stackoverflow. I'll edit my question.
–
MarcJan 3 '12 at 5:40

Correct of course it isn't within the rails app. But it does exist on disk. It's in the jquery-rails gem in vendor/assets/javascripts. This can be helpful to know when trying needed to track down error messages that are only pointing to jquery code.
–
Ken ThompsonSep 5 '12 at 20:46

Exactly this is in my app/assets/javascripts/application.js and nothing more. You can get it from github. There is no javascript code except the built in jquery. I think it's an issue between Chrome and JQuery. But try it yourself.
–
MarcJan 4 '12 at 11:11

@lunij downloading the code and debugging is something I charge people for... if you'll host the code on heroku and give a link where I can see the javascript without spending a ton of time, I'll do that.
–
Jesse WolgamottJan 4 '12 at 14:38

A few weeks ago, I just deactivated all my Chrome extensions, restarted Chrome and everything worked fine. I don't know which Chrome extensions I was using at the time when I created this question. The only thing I know is, there was one extension extending and corrupting the javascript code. That's the reason for all these strange error messages viewed by Chrome Inspector. I don't know which specific extension it really was, but it must be one of the popular ad-blocking or popup-blocking extensions. Just deactivate all your Chrome extensions and figure out if your code runs fine now.