lib/rails_devs_for_data_integrity.rb
# Return the foreign key name from the foreign key exception
Return the foreign key name from the foreign key exception
Return the foreign key name from the foreign key exception
def foreign_key_from_error_message(exception)
    if (match = exception.to_s.match(/^Mysql::Error.*foreign key constraint fails.*FOREIGN KEY\s*\(`?([\w_]*)`?\)/))
      return match[1].dup
    end
  end
def foreign_key_from_error_message ( exception ) if ( match = exception . to_s . match ( / ^Mysql::Error.*foreign key constraint fails.*FOREIGN KEY \s * \( `?([ \w _]*)`? \) / ) ) return match [ 1 ] . dup end end
Return the foreign key name from the foreign key exception
Return the foreign key name from the foreign key exception
exception