Sha256: 1fb84542882a4a18882da1963480670a169e8343c9e07f900650e588a9effbbd
Contents?: true
Size: 1007 Bytes
Versions: 14
Compression:
Stored size: 1007 Bytes
Contents
module Comee module Core class ClientPrice < Price enum :margin_type, {increase: 0, discount: 1} belongs_to :client belongs_to :previous_price, class_name: "Comee::Core::ClientPrice", optional: true belongs_to :next_price, class_name: "Comee::Core::ClientPrice", optional: true validates :price, :margin_type, presence: true validates :price, numericality: {greater_than: 0} validates :margin, presence: true, numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 100} validates :product_id, uniqueness: {scope: %i[client_id previous_price_id next_price_id status]} def self.ransackable_attributes(_auth_object = nil) %w[ valid_from valid_to price status product_id client_id previous_price_id next_price_id ] end def self.ransackable_associations(_auth_object = nil) %w[product client] end end end end
Version data entries
14 entries across 14 versions & 1 rubygems