Reputation: 706
How can I use the link_to method in Rails 4 to provide the same effect as
<a href="(mysite.example.com)" class="tooltips" data-toggle="tooltip" data-placement="top" title="" data-original-title="Facebook">
Upvotes: 18
Views: 19175
Reputation: 52308
A simple working example to copy and edit:
<%= link_to "My hidden stuff", "#collapseArea", { class: "btn btn-light", 'data-toggle': "collapse" } %><br><br>
<div class="collapse" id="collapseArea">
<p>Hidden</p>
<p>content</p>
<p>goes</p>
<p>here</p>
</div>
Upvotes: 0
Reputation: 4009
<%= link_to 'my site', 'mysite.example.com', { :class => 'tooltips', 'data-toggle' => 'tooltip', 'data-placement' => 'top', :title => '', 'data-original-title' => 'Facebook' } %>
Or
<%= link_to 'my site', root_path, class: 'tooltips', title: '', data: { toggle: 'tooltip', placement: 'top', original_title: 'Facebook' } %>
Or
<%= link_to 'my site', { controller: 'home', action: 'index' }, { class: 'tooltips', title: '', data: { toggle: 'tooltip', placement: 'top', original_title: 'Facebook' } } %>
Upvotes: 45