rescuing from Mysql2::Error
Mysql2::Error
is wrapped in another exception class now. Change your code to:
begin self.foo << barrescue Exception => e # only for debug purposes, don't rescue Exception in real code logger.debug "#{e.class}"end
...and you'll see the real exception class that you need to rescue.
Edit: It seems in this case it turned out to be ActiveRecord::RecordNotUnique