Sha256: 685815771ac4ac73abe22d2f52587876915c910f5b2ef983ad1da7d70cbadd9f

Contents?: true

Size: 485 Bytes

Versions: 15

Compression:

Stored size: 485 Bytes

Contents

module Spree
  class Promotion::Rules::User < PromotionRule
    belongs_to :user
    has_and_belongs_to_many :users, :class_name => '::Spree::User', :join_table => 'spree_promotion_rules_users', :foreign_key => 'promotion_rule_id'

    def eligible?(order, options = {})
      users.none? or 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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
spree_promo-1.0.7 app/models/spree/promotion/rules/user.rb
spree_promo-1.0.6 app/models/spree/promotion/rules/user.rb
spree_promo-1.1.1 app/models/spree/promotion/rules/user.rb
spree_promo-1.1.0 app/models/spree/promotion/rules/user.rb
spree_promo-1.0.4 app/models/spree/promotion/rules/user.rb
spree_promo-1.1.0.rc2 app/models/spree/promotion/rules/user.rb
spree_promo-1.1.0.rc1 app/models/spree/promotion/rules/user.rb
spree_promo-1.0.3 app/models/spree/promotion/rules/user.rb
spree_promo-1.0.2 app/models/spree/promotion/rules/user.rb
spree_promo-1.0.1 app/models/spree/promotion/rules/user.rb
spree_promo-1.0.0 app/models/spree/promotion/rules/user.rb
spree_promo-1.0.0.rc4 app/models/spree/promotion/rules/user.rb
spree_promo-1.0.0.rc3 app/models/spree/promotion/rules/user.rb
spree_promo-1.0.0.rc2 app/models/spree/promotion/rules/user.rb
spree_promo-1.0.0.rc1 app/models/spree/promotion/rules/user.rb