class UserResourcesValidator < ActiveModel::Validator
  def validate(record)
    record.errors.add :gold, I18n.t('user.needs_integer') if !record.resources[:gold].is_a?(Integer)
    record.errors.add :iron, I18n.t('user.needs_integer') if !record.resources[:iron].is_a?(Integer)
    record.errors.add :titanium, I18n.t('user.needs_integer') if !record.resources[:titanium].is_a?(Integer)
  end
end
