module Validations::SetupValidations def validate_irproduct_other(record) if intermediate_product_rent_type?(record) && record.irproduct_other.blank? record.errors.add :irproduct_other, I18n.t("validations.setup.intermediate_rent_product_name.blank") end end private def intermediate_product_rent_type?(record) record.rent_type == 5 end end