Pat Maddox wrote:
> ActiveRecord doesn't know anything about db constraint errors. If one
> is violated, the error propagates up in the form of an exception.
>
I realize that, but the exception is of the
ActiveRecord:StatementInvalid class, which I should be able to catch in
the controller with a rescue clause. But, I am not getting this to work
at the moment. I thought that this should at least produce some out put
but it never does:
def create
@entity = Entity.new(params[:entity])
...
respond_to do |format|
...
end
end
rescue => my_exception
puts "Rescue clause invoked!"
puts my_exception
end
For now, all I want is to see the rescue clause invoked, but it is not.
have I put this clause in the wrong place? Am I specifying it wrong?
--
Posted via http://www.ruby-forum.com/.