I’m using jQuery-UI’s tabs, which don’t seem to like the content_tag_for method of joining the record with the id using an underscore. Is there a way to force content_tag_for to use dashes instead of underscores without redefining content_tag_for in my application helper with some nasty gsub? Here’s my code as it is.
<ul class="ui-tabs-nav">
<% @preview_articles.each do |article| %>
<%= content_tag_for(:li, article, 'nav-fragment', :class => "ui-tabs-nav-item #{'ui-tabs-selected' if article == @preview_articles.first}") do %>
<%= link_to image_tag(article.photos.first.image.url(:thumbnail)), "#fragment-#{article.id}" %>
<% end %>
<% end %>
</ul>
I need that li tag to have an id of nav-fragment-article-id whereas content_tag_for is creating an id like nav-fragment-article_id.
Any suggestions on getting jquery-ui’s tabs to work with underscores are welcome, too.
You can monkey patch
ActionController::RecordIdentifier, like so:Just stick this into an initializer somewhere and you’re good to go, even though it’ll generate a warning because the constant was defined before.