order api - WIP & db structure change

This commit is contained in:
Min Zeya Phyo
2017-04-04 12:18:17 +06:30
parent aba3e52d0b
commit bcdce092cc
21 changed files with 120 additions and 130 deletions

View File

@@ -5,5 +5,7 @@ class Customer < ApplicationRecord
validates_presence_of :name, :contact_no
validates :contact_no, uniqueness: true
def lastest_invoices
sales.where(:customer_id => self.id).order("created_at desc").limit(5)
end
end