Sha256: baa92c200a22debab2fa938509ad9e992464c0fa865881fd6b0140cfa2a8abf6
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
module Dust class Contact < ActiveRecord::Base attr_accessible :name, :email, :company_name, :phone, :address, :city, :state, :zip, :message, :hear validates_presence_of :name validates_presence_of :email validates_format_of :email, :with => /^([^\s]+)((?:[-a-z0-9]\.)[a-z]{2,})$/i, :message => "Should look like an email address." validates_presence_of :message def self.total_on(date) where("date(created_at) = ?", date) end def self.page(search, page, date) search(search, date).order("created_at DESC").paginate(:per_page => 12, :page => page) end def deliver_messages Dust.config.mailer.contact_confirmation(self).deliver Dust.config.mailer.contact_request(self).deliver end def self.search(search, date) if search where("name LIKE ? OR email LIKE ? OR message LIKE ?", "%#{search}%", "%#{search}%", "%#{search}%") elsif date where("date(created_at) IS ?", (Time.at(date.to_i / 1000)).to_date) else scoped end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dust-cms-0.0.07 | app/models/dust/contact.rb |
dust-cms-0.0.06 | app/models/dust/contact.rb |
dust-cms-0.0.05 | app/models/dust/contact.rb |