Reputation: 712
I had this line of code in my html.erb file in the static folder:
<a href="<%= video['link'] %>" role="tab" data-toggle="tab"><%= video['caption'] %></a>
I changed it to:
<%= link_to video['link'], video['caption'], role: 'tab', data: { toggle: 'tab' } %>
Now my video is not loading and the caption is showing up as the URL of the video. Can anybody tell me what's going on here.
Thanks.
Upvotes: 0
Views: 149
Reputation: 2857
link_to helper take display text as first parameter and url as second parameter. So
<%= link_to video['caption'], video['link'], role: 'tab', data: { toggle: 'tab' } %>
Or if you need formatted html instead of plain text, try something like
<%= link_to video['link'], role: 'tab', data: { toggle: 'tab' } do %>
<b><%= video[:caption] %></b>
<% end %>
For more details, please visit apidock
http://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to
Upvotes: 0
Reputation:
try this....
<%= link_to video['caption'], video['link'], role: 'tab', data: { toggle: 'tab' } %>
Upvotes: 2
Reputation: 712
I figured it out:
You change it to:
<%= link_to video['caption'], video['link'], role: 'tab', data: { toggle: 'tab' } %>
Upvotes: 2