Rendered partial is not visible?

124 Views Asked by At

So I'm passing down locals to a partial via PublicActivity and try to render the partial on the users/show.html.erb file, like so:

<% @activities.each do |act| %>
  <% render partial: "posts/#{act.trackable.check_type}", 
  locals: { tweet: tweet.trackable }%>
<% end %>

But this results into nothing. I don't see the partial at all. It's not visible. All data that is passed down is not nil, double confirmed via byebug and rails console.

Any ideas what could cause the invisibility of the partial?

1

There are 1 best solutions below

0
On BEST ANSWER

<% %> Executes the ruby code, but doesn't print it.

<%= %> Prints the result into the erb file.

So, the code should be:

<%= render partial: "posts/#{act.trackable.check_type}", 
    locals: { tweet: tweet.trackable }%>

More:
<%# %> : is for comment in erb