Class: Effective::EventProduct

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/effective/event_product.rb

Instance Method Summary collapse

Instance Method Details

#capacity_availableObject



49
50
51
52
# File 'app/models/effective/event_product.rb', line 49

def capacity_available
  return nil if capacity.blank?
  [(capacity - registered_event_addons_count), 0].max
end

#purchased_event_addons_countObject



58
59
60
# File 'app/models/effective/event_product.rb', line 58

def purchased_event_addons_count
  purchased_event_addons.length
end

#registered_event_addons_countObject



54
55
56
# File 'app/models/effective/event_product.rb', line 54

def registered_event_addons_count
  registered_event_addons.length
end

#to_sObject



45
46
47
# File 'app/models/effective/event_product.rb', line 45

def to_s
  title.presence || 'New Event Product'
end