Sha256: 0ffa91e50d8abfc8e0e9784e9dd3c1dc7c7eaa2fca9896e6d2b71e1e2e2c5d92
Contents?: true
Size: 880 Bytes
Versions: 1
Compression:
Stored size: 880 Bytes
Contents
module Workarea class Email::Share include ApplicationDocument field :to_name, type: String field :to_email, type: String field :from_name, type: String field :from_email, type: String field :message, type: String field :title, type: String field :url, type: String validates :to_email, presence: true, email: true validates :from_email, presence: true, email: true validates :message, length: { maximum: Workarea.config.max_email_share_message_length } validates :url, presence: true after_initialize :sanitize_url before_validation :sanitize_url private def uri URI.parse(url) end def sanitize_url return unless url.present? self.url = if uri.query.present? [uri.path, uri.query].join('?') else uri.path end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
workarea-share-1.2.4 | app/models/workarea/email/share.rb |