Sha256: 36fe628d593e40f4fe71bfb4001e9ca9ac3b374400506833f36edf33ad2c3ea6

Contents?: true

Size: 418 Bytes

Versions: 3

Compression:

Stored size: 418 Bytes

Contents

class Promotion::Rules::User < PromotionRule
  belongs_to :user
  has_and_belongs_to_many :users, :class_name => '::User', :join_table => 'promotion_rules_users', :foreign_key => 'promotion_rule_id'
  
  def eligible?(order)
    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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_promo-0.30.2 app/models/promotion/rules/user.rb
spree_promo-0.30.1 app/models/promotion/rules/user.rb
spree_promo-0.30.0 app/models/promotion/rules/user.rb