I’m pretty new to Rails and was wondering what the best practice is
with respect to render :update. Should logic be placed in the :update
blocks or should the logic be outside the blocks with separate blocks
provided for each case?
i.e.
render :update do |page|
if condition1
page.replace_html …
<rest of code for condition 2>
else
page.replace_html…
<rest of code for condition 2>
end
or
if condition1
render :update do |page|
<code for condition 1>
end
else
render :update do |page|
<code for condition 2>
end
end
Also, when is it preferable to use an RJS template over render :update?