From e252c0acc3719fbc8a13f1fffbfa7fe258962906 Mon Sep 17 00:00:00 2001 From: phyusin Date: Mon, 5 Mar 2018 15:00:18 +0630 Subject: [PATCH] check product account --- app/models/product.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/product.rb b/app/models/product.rb index 9482b376..3256fe17 100755 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -5,13 +5,13 @@ class Product < ApplicationRecord mount_uploader :image_path, ProductImageUploader def self.search_by_product_code(item_code) - account = Account.where('title','like','%Product%').first() + account = Account.find_by_title('Product') if !account.nil? account_id = account.id else account_id = 1 end - + menu_item_hash = Hash.new mt_instance = Product.find_by_item_code(item_code) if (!mt_instance.nil?)