You can improve more this code. 
use validation instead of before_save and use exists? instead of empty?, look 
 ```ruby
  validate :not_repeat_city

  def not_repeat_city
    if Location.where("city= ? AND countri = ? AND state = ?",
                      self.city, self.countri, self.state).exists?
      errors.add(:city, I18n.t('activerecord.models.errors.message_location_insert'))
    end
  end
 ```