Sha256: 47a9b3adaf7d8c6ea5b185fe42251135ba8ca87ebaf05ad8f4fa4174763df3d0
Contents?: true
Size: 773 Bytes
Versions: 5
Compression:
Stored size: 773 Bytes
Contents
class ContactUs::Contact include ActiveModel::Conversion include ActiveModel::Validations attr_accessor :email, :message, :name, :subject validates :email, :format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i }, :presence => true validates :message, :presence => true validates :name, :presence => {:if => Proc.new{ContactUs.require_name}} validates :subject, :presence => {:if => Proc.new{ContactUs.require_subject}} def initialize(attributes = {}) attributes.each do |key, value| self.send("#{key}=", value) end end def save if self.valid? ContactUs::ContactMailer.contact_email(self).deliver return true end return false end def persisted? false end end
Version data entries
5 entries across 5 versions & 1 rubygems