Sha256: 895f824ebffb163309a63865a70881d632a13f7b678e8b645638e5f5a9d3c626
Contents?: true
Size: 966 Bytes
Versions: 2
Compression:
Stored size: 966 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: :max_email_share_message_length } validates :url, presence: true after_initialize :sanitize_url before_validation :sanitize_url private def max_email_share_message_length Workarea.config.max_email_share_message_length end 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
workarea-share-1.3.1 | app/models/workarea/email/share.rb |
workarea-share-1.3.0 | app/models/workarea/email/share.rb |