Reputation: 7390
I want to run this block only a condition is satisfied
<% if condition %>
<% progressive_render do %>
SLOW CODE HERE
<% end %>
<% end %>
IF condition = true
SLOW CODE should be runnned wrapped by "progressive_render"
IF condition = true
SLOW CODE shoud be runned not wrapped by progressive_render. So runned anyway.
Upvotes: 0
Views: 187
Reputation: 33420
You can replace the if-else
condition with a guard clause (plus unless
condition):
<% SLOW CODE HERE unless condition %>
<% progressive_render { SLOW CODE HERE } %>
Upvotes: 1