Sha256: 046500de2e8538d3722a627516ea3203f93499f86c8b715e3e97d86182641c1b
Contents?: true
Size: 689 Bytes
Versions: 13
Compression:
Stored size: 689 Bytes
Contents
module Spree class Promotion module Rules class User < PromotionRule belongs_to :user, class_name: "::#{Spree.user_class.to_s}" has_and_belongs_to_many :users, class_name: "::#{Spree.user_class.to_s}", join_table: 'spree_promotion_rules_users', foreign_key: 'promotion_rule_id' 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) self.user_ids = s.to_s.split(',').map(&:strip) end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems