Sha256: 21fa1e95220f438f7a8c13619b24f5a0bbc752731c86d0b9592752c74689d441
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 => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/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