module Mks module Rate class ServiceBundle < ApplicationRecord belongs_to :service_delivery_unit has_and_belongs_to_many :chargeable_services, join_table: 'mks_rate_service_bundles_chargeable_services' validates :code, :name, :percent_discount, presence: true validates :code, uniqueness: true validates_numericality_of :percent_discount, greater_than_or_equal_to: 0, less_than_or_equal_to: 100 delegate(:name, to: :service_delivery_unit, prefix: true) end end end