custom primary key for transaction

This commit is contained in:
Min Zeya Phyo
2017-06-04 16:27:14 +06:30
parent 394d2ed938
commit 4fc511d531
19 changed files with 88 additions and 55 deletions

View File

@@ -1,9 +1,15 @@
class SaleItem < ApplicationRecord
#primary key - need to be unique generated for multiple shops
#primary key - need to be unique generated for multiple shops
before_create :generate_custom_id
belongs_to :sale
#compute items - discount, tax, price_change
def compute_item
end
private
def generate_custom_id
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")
end
end