move table

This commit is contained in:
Nweni
2017-06-22 16:31:41 +06:30
parent 09252ba055
commit 0c0e44c808
8 changed files with 44 additions and 20 deletions

View File

@@ -6,7 +6,7 @@ class Customer < ApplicationRecord
has_many :orders
has_many :sales
validates_presence_of :name, :contact_no, :email,:company,:card_no
validates_presence_of :name, :contact_no, :email,:card_no
validates :contact_no, uniqueness: true
validates :email, uniqueness: true
validates :card_no, uniqueness: true
@@ -34,7 +34,7 @@ class Customer < ApplicationRecord
end
return response;
end
def self.get_membership_transactions(customer)
@@ -58,13 +58,13 @@ class Customer < ApplicationRecord
end
return response;
end
def self.search(search)
if search
# find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])
where("name LIKE ? OR contact_no LIKE ? OR card_no LIKE ?", "%#{search}%", "%#{search}%", "%#{search}%",)
where("name LIKE ? OR contact_no LIKE ? OR card_no LIKE ?", "%#{search}%", "%#{search}%", "%#{search}%",)
else
find(:all)
end
@@ -80,8 +80,8 @@ class Customer < ApplicationRecord
end
WALKIN = "CUS-000000000001"
TAKEAWAY = "CUS-000000000002"
WALKIN = "CUS-000000000001"
TAKEAWAY = "CUS-000000000002"
private
def generate_custom_id