search for: nonexist_object

Displaying 1 result from an estimated 1 matches for "nonexist_object".

2009 Apr 12
1
handling ActiveRecord::RecordNotFound
How should we handle requests for invalid objects which do not exist in database, ActiveRecord::RecordNotFound error ? I am writing begin-rescue as follows: def show begin @phone = Phone.find(params[:id]) rescue ActiveRecord::RecordNotFound flash[:notice] = NONEXIST_OBJECT redirect_to :controller => :phone, :action => :index else respond_to do |format| format.html format.xml {render :xml => @agenda.to_xml} end end end Instead of repeating this for show, edit, and delete in every controller, I would like to put th...