This project is archived and is in readonly mode.
link_to does not respect options like :confirm and :popup if url is specified as part of :options itself
-
Samuel Danielson
The proper results in
<%=link_to "Delete asset","post/delete/#{post.id}",:confirm=>"Do u want to delete this post"%>are due to you passing :confirm as the third argument, which is "html_options". Break :confirm into the third arg so it gets passed as html_options.
<%=link_to "Delete asset",{:action=>"delete",:controller=>"post",:id=>post.id},{:confirm=>"Do u want to delete this post"}%>On a related note this has changed in edge. Some keys in html_options are converted to data-#{key}. Others, like :href, override the default. This is for the new javascript and rest stuff.
<%= link_to 'hello from edge', '', :batman_sidekick => 'robin', :confirm => 'Sure?' %><a href="" batman_sidekick="robin" data-confirm="Sure?">hello from edge</a> -
Rishav Rastogi
- Assigned user set to Ryan Bigg
Invalid. Not using link_to properly as mentioned in the above comment.
-
Ryan Bigg
- State changed from new to invalid
I will mention also here that it's probably best to use the RESTful helpers for this (assuming you set them up in config/routes.rb first!
<%= link_to 'delete asset', post_path(post), :method => :delete, :confirm => "Do you want to delete this post?" %>