Class: Accountability::Product
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Accountability::Product
- Defined in:
- app/models/accountability/product.rb
Instance Method Summary collapse
Instance Method Details
#inventory ⇒ Object
18 19 20 21 22 |
# File 'app/models/accountability/product.rb', line 18 def inventory return [] if source_class.nil? source_class.where(**source_scope) end |
#offerable_template ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/models/accountability/product.rb', line 24 def offerable_template return if offerable_category.nil? return @offerable if @offerable.present? offerable = Offerable.collection[offerable_category.to_sym] return offerable if new_record? if offerable.present? @offerable = offerable else raise_offerable_not_found end end |
#source_class ⇒ Object
39 40 41 42 43 |
# File 'app/models/accountability/product.rb', line 39 def source_class return if offerable_template.nil? offerable_template.class_name.constantize end |