Created
January 25, 2011 06:49
-
-
Save dangalipo/794581 to your computer and use it in GitHub Desktop.
exception handling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def merge_suppliers | |
@supplier_from = Supplier.find(params[:id]) | |
begin | |
@supplier_to = Supplier.find(params[:supplier_id]) | |
rescue ActiveRecord::RecordNotFound | |
flash[:error] = "#{t('object.supplier')} #{t('messages.not_found')}" | |
redirect_to manage_supplier_path(@supplier_from.id) | |
end | |
render :merge_suppliers | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok basically what im trying to do is if it throws the not found except redirect back otherwise render the template.