Following Michael Hartl’s tutorial. Using Rails 3.0.9 under Ubuntu. The following line is in application.html.erb:
<%= javascript_include_tag :defaults %>
No jQuery. Tutorial Listing 10.38 specifies the Delete action be called as follows:
<%= link_to "delete", user, :method => :delete, :confirm => "You sure?",
:title => "Delete #{user.name}" %>
The generated HTML includes the title tag, e.g.:
<a href="/users/13" data-confirm="You sure?" data-method="delete"
rel="nofollow" title="Delete Mylene Gaylord">delete</a>
I assume the purpose of specifying a title is for the popup to identify which user will be deleted. However the title is never displayed in the confirmation popup. Instead:
- Firefox 3 under Ubuntu: Title shows as “The page at http://0.0.0.0 says:”.
- Firefox 5 under Win7: No title at all; popup appears “Ajaxified” with browser dimmed in background
- IE8 under Win7: Title shows as “Message from webpage”.
Can Rails display the title in the popup?
Can I write an RSpec test to confirm that the title is correct?
The title option that’s used there is specifically for the link title so that when you hover your mouse over the link, the value of title shows up as a sort-of tooltip.
If you want to add things like a title to your popup messages, you’ll need to roll your own popups that support that kind of thing.