question about exception

   In the controller I have the function

   def convert_sd_ticket_to_incident

  Now in the ServiceDeskTicket model
  def self.close_ticket(sd_id,created_by,modified_by)
      ActiveRecord::Base.transaction do
        sd_ticket.update_attributes!(:service_desk_status_id => 7 )
        code continues
      rescue Exception => e:
          puts 'error is '+e.to_s

    Now my problem is this ServiceDeskTicket has a validation
validates_presence_of :description
      It is only implemented now and there are some records in the db
which have no description..So suppose if I tries to convert any such
record to an incident what happens is the above code in the model
ServiceDeskTicket rollsback since it gets exception that description
empty...But what happens now is in the controller code above the rest ie
    which is executed (this code converts the ticket to incident)
         The solution which i am searching is how can I handle (get) the
above exception that is happening in the model in the controller and
redirect to the same page saying that "Please give a description first"
      I know I can restrict the Incident being added to check whether
the return value of
   ServiceDeskTicket.close_ticket(sd_id,created_by_id,modified_by_id) is
     But how can I handle this.Please help


If you need to notify the user of error, the best way is using flash
(in the controller). For instance, in the rescue part of that last
function do something like this:

rescue Exception => e
  flash[:error] = e.to_s
  redirect :controller => ... , :action => ...

And in the view of the page you are redirecting to, make sure you have
a reserved space to show flash messages like so:

<p class='error'><%= flash[:error] -%></p>

Hope it was of help.