Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

after_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

end
Source by coderoad.ru #
 
PREVIOUS NEXT
Tagged: #STI #rails
ADD COMMENT
Topic
Name
7+1 =