seed generator fun:

This commit is contained in:
phyusin
2018-10-16 17:38:33 +06:30
parent ed2398a495
commit a6393a5140
2 changed files with 8 additions and 6 deletions

View File

@@ -21,7 +21,6 @@ class SeedGenerator < ApplicationRecord
seed.model = "sale"
new_receipt_no = seed.next
seed.save
else
current_no = seed.next
seed.next = seed.next
@@ -85,7 +84,7 @@ class SeedGenerator < ApplicationRecord
current = 0
nex = 0
update_sql = "UPDATE seed_generators set current = current + 1, next = next + 1 WHERE model='#{model}';"
update_sql = "UPDATE seed_generators set current = next, next = next + 1 WHERE model='#{model}';"
select_sql = "select * from seed_generators where model='#{model}';"
update_result = ActiveRecord::Base.connection.execute(update_sql);