title: How to do "redirect_to and return" to exit fully or redirect_to immediately?
body: <p>I have this as my code:</p>
  
  <pre><code>def index
    @monkeys = Monkey.where(owner: current_user)
  end
  
  def new
    @monkey = Monkey.new name: 'Monkey 1', alive: true, owner: current_user
  end
  
  def create
    @monkey = Monkey.create monkey_params
    # Other fields and save here
  end
  
  def edit
    @monkey = Monkey.find_by(id: params[:id], owner: current_user)
    check_on_monkey_first(@monkey)
  end
  
  def update
    @monkey = Monkey.find_by(id: params[:id], owner: current_user)
    check_on_monkey_first(@monkey)
  
    if @monkey.update(monkey_params)
      redirect_to monkeys_path, success: 'Monkey saved'
    end
  end
  
  private
  def check_on_monkey_first(monkey)
    redirect_to monkeys_path, flash: {info: "Monkey doesn't exist"} and return unless monkey
    redirect_to monkeys_path, flash: {info: "Monkey no longer exist"} and return if !monkey.alive?
  end
  
  def monkey_params
    # some_fields_here
  end
  </code></pre>
  
  <p>The thing is I think "... and return" only early-exits the <code>check_on_monkey_first</code> and then continues on to <code>update</code>.</p>
  
  <p>If I am not the owner of the <code>Monkey</code>, <code>find_by</code> wouldn't get a record and SHOULD do a <code>redirect_to</code> because <code>Monkey</code> would not exist. But it still continues and breaks code at <code>if @monkey.update(monkey_params)</code> because <code>@monkey</code> is nil.</p>
  
  <p>How do I do a "redirect_to some_path and return" in Ruby or Rails? How do I stop and do a redirect_to immediately?</p>