Exception handling

Hi
I have code in model as

def self.record_paginate_pb(search_pb_ui_hash,page)
problem_number=search_pb_ui_hash[:number]
problem_priority_id=search_pb_ui_hash[:problem_priority_id]
search_problem = self.find_where_options :order => ‘created_on DESC’ do
|pb|
pb.number1.downcase =~ “%”+problem_number.downcase+"%" if
!problem_number.nil?
pb.problem_priority_id== problem_priority_id
end
rescue ActiveRecord::ActiveRecordError => e:
puts 'error happened '+e.to_s
else
paginate search_problem.update( :per_page=>10,:page => page )
end
and this is called from controller as
@search_pb_result=Problem.record_paginate_pb(params[:problem],
params[:page])

I am new to ruby’s exception handling (learning)…How can I write a
rescue block for the above code …I tried like above but is not
working…Could you please help me and also point to some good tutorials
on rails exception handling?

Thanks in advance
Sijo

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs