Module: Skr::Concerns::Sku::Uoms
- Defined in:
- lib/skr/concerns/sku_extensions.rb
Instance Method Summary collapse
- #default ⇒ Object
-
#with_code(code) ⇒ Object
Return the uom with code.
Instance Method Details
#default ⇒ Object
36 37 38 39 |
# File 'lib/skr/concerns/sku_extensions.rb', line 36 def default code = self.proxy_association.owner.default_uom_code with_code( code ) end |
#with_code(code) ⇒ Object
Return the uom with code. Since the UOM’s are probably already loaded for the SKU, it makes sense to search over the in-memory collection vs hitting the DB again.
44 45 46 |
# File 'lib/skr/concerns/sku_extensions.rb', line 44 def with_code( code ) detect{|uom| uom.code == code } end |