Sha256: d60d949e6a0bb1934bd98a0f437e43e71fa659dc41decf7a922e86ce944ec248
Contents?: true
Size: 744 Bytes
Versions: 55
Compression:
Stored size: 744 Bytes
Contents
module Comee module Core class AdditionalService < ApplicationRecord before_save :calculate_total_price after_save :update_sales_order belongs_to :sales_order validates :name, :unit, presence: true validates :quantity, :price, presence: true, numericality: {greater_than: 0} def calculate_total_price self.total_price = (price * quantity).round(2) end def update_sales_order sales_order.calculate_total_price sales_order.calculate_vat end def self.ransackable_attributes(_auth_object = nil) %w[id name sales_order_id] end def self.ransackable_associations(_auth_object = nil) %w[sales_order] end end end end
Version data entries
55 entries across 55 versions & 1 rubygems