back/app/models/coin_reward.rb
def validate_referral_not_rewarded
    # Skip if referral is absent, let another validation take care of it:
    return unless referral.present?
    referral_already_rewarded = CoinReward.find_by(referral_id: referral.id).present?
    errors.add(:referral, "has already been rewarded with a coin minting") if referral_already_rewarded
  end
# See the comment in CoinRewardsController#mint about the way the referral
# mechanism should work when we have external social apps, with a minting quota.
See the comment in CoinRewardsController#mint about the way the referral
mechanism should work when we have external social apps, with a minting quota.
See the comment in CoinRewardsController#mint about the way the referral mechanism should work when we have external social apps with a minting quota .
def validate_referral_not_rewarded
    return unless referral.present?
    referral_already_rewarded = CoinReward.find_by(referral_id: referral.id).present?
    errors.add(:referral, "has already been rewarded with a coin minting") if referral_already_rewarded
  end
def validate_referral_not_rewarded return unless referral . present? referral_already_rewarded = CoinReward . find_by ( referral_id : referral . id ) . present? errors . add ( :referral , "has already been rewarded with a coin minting" ) if referral_already_rewarded end
See the comment in CoinRewardsController#mint about the way the referral
mechanism should work when we have external social apps, with a minting quota.
See the comment in CoinRewardsController#mint about the way the referral mechanism should work when we have external social apps with a minting quota .
# Skip if referral is absent, let another validation take care of it: