An action may contain only a single render or a single redirect. Attempting to try to do either again will result in a DoubleRenderError:
def do_something redirect_to :action => "elsewhere" render :action => "overthere" # raises DoubleRenderError end
If you need to redirect on the condition of something, then be sure to add “and return” to halt execution.
def do_something redirect_to(:action => "elsewhere") and return if monkeys.nil? render :action => "overthere" # won't be called if monkeys is nil end