Last active
December 17, 2015 15:29
-
-
Save dmz006/5632527 to your computer and use it in GitHub Desktop.
multiple rails rescues in single method
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 show | |
begin | |
@jobqueue = Delayed::Job.find(session[:jobqueue]) if session[:jobqueue] | |
rescue ActiveRecord::RecordNotFound | |
session[:jobqueue] = nil | |
return | |
end | |
if @jobqueue.nil? && session[:jobqueue] | |
session[:jobqueue] = nil | |
end | |
begin | |
@item = Item.find(params[:id]) if (params[:id]) | |
rescue ActiveRecord::RecordNotFound | |
redirect_to item_index_path | |
return | |
end | |
@categories = Category.find(:all, :order => "name") | |
respond_to do |format| | |
format.html | |
format.js | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment