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



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

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

#purchased_event_addons_countObject



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

def purchased_event_addons_count
  purchased_event_addons.length
end

#registered_event_addons_countObject



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

def registered_event_addons_count
  registered_event_addons.length
end

#to_sObject



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

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