Class: ProductMovement

Inherits:
Ekylibre::Record::Base show all
Includes:
Taskable
Defined in:
app/models/product_movement.rb

Overview

A product move is a movement of population

Instance Method Summary collapse

Methods included from Taskable

#ensure_originator_type

Methods inherited from Ekylibre::Record::Base

#already_updated?, #check_if_destroyable?, #check_if_updateable?, columns_definition, #customizable?, customizable?, #customized?, #destroyable?, #editable?, has_picture, #human_attribute_name, nomenclature_reflections, #old_record, #others, refers_to, #unsuppress, #updateable?

Methods included from Userstamp::Stampable

included

Methods included from Userstamp::Stamper

included

Instance Method Details

#populationObject


64
65
66
# File 'app/models/product_movement.rb', line 64

def population
  Maybe(product_population).value.or_else(0)
end

#product_populationObject


68
69
70
# File 'app/models/product_movement.rb', line 68

def product_population
  ProductPopulation.find_by(product_id: product_id, started_at: started_at)
end