Sha256: fe84421dff3289d5c899248d3a39d4a644b96e6dbed8a146f0d461ec4700f902
Contents?: true
Size: 785 Bytes
Versions: 18
Compression:
Stored size: 785 Bytes
Contents
module Workarea class Inquiry include ApplicationDocument field :name, type: String field :email, type: String field :order_id, type: String field :subject, type: String field :message, type: String validates :subject, length: { maximum: 1_000 } validates :message, presence: true, length: { maximum: 2_000 } validate :subject_exists def full_subject I18n.t('workarea.inquiry.subjects')[subject.optionize.to_sym].presence || Workarea.config.inquiry_subjects[subject] end private def subject_exists unless subject.blank? || Workarea.config.inquiry_subjects.keys.include?(subject) errors.add(:subject, I18n.t('errors.messages.inclusion')) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems