Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
437 B
2
Indexable
Never
class BookingOptionDayRate < ApplicationRecord
  belongs_to :booking_option

  before_validation :init_default_weekday_day_rate, unless: ->(w) { w.weekday_day_rate_enabled? }
  before_validation :init_default_weekend_day_rate, unless: ->(w) { w.weekend_day_rate_enabled? }
  private

  def init_default_weekday_day_rate
    self.weekday_day_rate ||= 0
  end

  def init_default_weekend_day_rate
    self.weekend_day_rate ||= 0
  end
end