render :update and best practices

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?

I usually do it like second option (less code possible in render block),
but not sure which is better and why.

As you have asked for better practice to use render :update. I would like to say best is that dont use render :update, have related rjs file for action. You could write render :update in controller action. But it is again MVC… render :update call is just for ui… we update divs, replace divs with the help of it. It gets difficult to handle also. There should be separation between view code and controller code.

– Anil