Rails - Rendering partial inside Twitter Bootstrap popover

I want to use the Twitter popup downloader to display the user's avatar and email address, with the option of adding more details later.

I'm having a problem getting a partial display inside the link content field. View code below (in HAML).

%span.comment-username
    =link_to comment.user_name, "#", "title" => comment.user_name,
      "data-content" => "=render 'users/name_popover'", 
      class: "comment-user-name"

Currently, this will only result in the creation of the content code as a string.

Is there a way to do this so that the part is inserted instead of code as a string?

+5
source share
2 answers

You want the rails to really evaluate the contents of the string, rather than just display the string. The easiest way to do this:

%span.comment-username
  =link_to comment.user_name, "#", "title" => comment.user_name,
    "data-content" => "#{render 'users/name_popover'}", 
      class: "comment-user-name"

render , .

+10

jrc - .

, HAML, :

`<%= link_to('Service History' , '#', :class => "popover-history", :rel => "popover", :"data-placement" => "bottom", :title => "Service History", :"data-content" => "#{render 'services/service_history'}") %>`

`$(function () {
$('.popover-history').popover({ html : true });
});`
+1

All Articles