[Rails] Re: Rescuing ActiveRecord errors without logging

2015-04-21 Thread Inba
I'm not speaking about the encoding issue but about the exception rescue issue. Imagine I would like to handle unique key exceptions for instance. On Monday, April 20, 2015 at 5:53:05 PM UTC+3, Ruby-Forum.com User wrote: > > Hi there , i don't know if that will help you , but i did have this kind

[Rails] Rescuing ActiveRecord errors without logging

2015-04-19 Thread Inba
Hi, I have the following piece of code: begin DummyModel.create(record) rescue if $!.class == ActiveRecord::StatementInvalid and $!.to_s['PG::CharacterNotInRepertoire'] Logger.info("Issues with encoding for #{record[:email_domain]}. Attempting encoding") DummyModel.create(Utils.encode_record_