after_create for STI rails
after_create : create_coupons_for_existing_users, unless: :discounted_coupon?after_create for STI rails
after_create : create_coupons_for_existing_users, unless: :discounted_coupon?after_create for STI rails
def create_coupons_for_existing_users
  return unless self.type == "DiscountedCoupon"
  # your logic here
endafter_create for STI rails
module Concerns::CouponDistribution
  extend ActiveSupport::Concern
  included do
    after_create :create_coupons_for_existing_users, if: Proc.new {|cd| cd.type == "DiscountedCoupon" }
  end
  def create_coupons_for_existing_users
    #
  end
endafter_create for STI rails
def discounted_coupon?
  self.type == "DiscountedCoupon"
endCopyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us
