views:

24

answers:

1
def r_return

  if var
    begin
      User.transaction do
        #code here
      end
    render :text => html
    return
    rescue => e
      #rescue here
    end
  else
    redirect_to root_path
  end
  #it has to been render at the end?
  #render :text => html
end

what's the wrong with my code? can't render it a begin...end block? or something I been missing?

A: 

It seems the exception is being throwed in begin-rescue block.

SMiX
yes, in the transaction block. there is araise ActiveRecord::RecordNotFound if some_conditionsbut the code is execute and rescue a recordnotfound. weird.