Class: EdiSkuTranslation
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- EdiSkuTranslation
- Defined in:
- app/models/edi_sku_translation.rb
Class Method Summary collapse
Methods inherited from ApplicationRecord
define_decrypted_attribute, define_decrypted_attributes, #errors_in_bullet_points, primary_connection, special_connection
Class Method Details
.table_data(product_id:, offset:, limit:, partner:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/models/edi_sku_translation.rb', line 9 def table_data( product_id:, offset:, limit:, partner: ) customer_supplier_id = partner.id customer_supplier_type = partner.entity_type query = <<-SQL SELECT s.sku_id, s.sku_code, s.product_id, p.product_code, st.sku_translation_id, st.customer_supplier_item_no, st.customer_supplier_description, st.customer_supplier_item_color, st.customer_supplier_item_size, st.customer_supplier_item_style, st.customer_supplier_item_dimension, st.active, st.translation_type FROM skus_master s LEFT JOIN SKUS_TRANSLATION st ON s.sku_id = st.sku_id AND st.customer_supplier_id = ? AND st.translation_type = ? LEFT JOIN products_master p ON s.product_id = p.product_id WHERE s.product_id = ? ORDER BY s.sku_id OFFSET ? ROWS FETCH NEXT ? ROWS ONLY; SQL EdiSkuTranslation.find_by_sql([ query, customer_supplier_id, customer_supplier_type, product_id, offset, limit ]).as_json end |