From: Sijo Kg Date: 2008-08-18T17:34:06+09:00 Subject: ruby exception handling Hi I have been learning exception handling in ruby.I am not familiar with the exception handling mechanisms (The project which I am working is my first project and it is in Ruby)..Could anyone explain me how to add exception handling coding for the following fragment Then it will be very valuable for me to understand exception handling mechanisms in ruby.Here what I am doing is first add an activity to the problem_activities table (which has problem_id as one of its field) and if there is attachment for that activity, that is added to problem_activity_attachments table (which has problem_activity_id as one of its column) def pb_activity_attach_file @problem=Problem.find(params[:id]) ActiveRecord::Base.transaction do @pb_activity=ProblemActivity.new(params[:pb_activity]) @pb_activity.problem_id= params[:id] save_result=@pb_activity.save! if !params[:pb_activity_attachment][:attachment].blank? if save_result @pb_activity_attachment=ProblemActivityAttachment.new(params[:pb_activity_attachment]) @pb_activity_attachment.problem_activity_id=@pb_activity.id.to_i @pb_activity_attachment.save! end end end #end of transaction @pb_activities=@problem.problem_activities.pb_activities_paginate(params[:page]) responds_to_parent do render :update do |page| page[:pb_create_activity_ui].replace :partial => "problem_part/view_pb_activity_details", :object => @pb_activities, :object => @problem end end #respond_to do end end -- Posted via http://www.ruby-forum.com/.