Rails 3: link_to with "data-confirm"


has anyone experienced any problems with the new link_to and
data-confirm in Rails3? It seems when you create a link with instead of
link text, an image, the confirm message isn't shown.

                        image_tag("delete.png", :alt =>
                        admin_category_path(:id => record, :format =>
                        "data-method" => "delete",
                        "data-confirm" => "#{t("categories.delete")}",
                        :remote => true

The above example deletes the record without asking confirmation first.

<%= link_to("Delete", admin_category_path(:id => record, :format =>
:js), "data-method" => "delete", "data-confirm" =>
"#{t("categories.delete")}", :remote => true) %>

The above example here, where the only difference is instead of an
image, you have a text link, the confirmation message is show.

Did you find a solution to this? I just hit this myself last night and
have spent a few hours trying to find an answer.

Hi Ray, I fixed the problem some time ago, but I'm not sure anymore what
the problem was.

I know I had some other problems as well, And they where all related to
a conflicting javascript library that I developed. It was not
conflicting with rails.js but with prototype.js .

I know I also upgraded the rails.js file to the latest version as well
as prototype (1.7 rc)

Ray Parker wrote:

I'll check into 1.7. I confirmed that this is a problem with

Create a new project, generate a scaffold for some Foo class. Confirm
that the delete link from the index page gives you a confirmation
dialog. Change the "Destroy" text to an image_tag and the confirmation
no longer works. I read somewhere else that this was an issue with the
JS library and the way that it's referring to page elements.