Sha256: 45b1fc3c6e05e8eaaba34aae33a844945239845b392f6b981fd793ce09c42ae9
Contents?: true
Size: 828 Bytes
Versions: 45
Compression:
Stored size: 828 Bytes
Contents
module Spree class Promotion module Rules class User < PromotionRule belongs_to :user, class_name: "::#{Spree.user_class}" has_many :promotion_rule_users, class_name: 'Spree::PromotionRuleUser', foreign_key: :promotion_rule_id, dependent: :destroy has_many :users, through: :promotion_rule_users, class_name: "::#{Spree.user_class}" def applicable?(promotable) promotable.is_a?(Spree::Order) end def eligible?(order, _options = {}) users.include?(order.user) end def user_ids_string user_ids.join(',') end def user_ids_string=(s) # check this self.user_ids = s end end end end end
Version data entries
45 entries across 45 versions & 1 rubygems