Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (20 sloc) 798 Bytes
module Refinery
module Inquiries
class Inquiry < Refinery::Core::BaseModel
filters_spam :message_field => :message,
:email_field => :email,
:author_field => :name,
:other_fields => [:phone],
:extra_spam_words => %w()
validates :name, :presence => true
validates :email, :format=> { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i }
validates :message, :presence => true
acts_as_indexed :fields => [:name, :email, :message, :phone]
default_scope :order => 'created_at DESC'
attr_accessible :name, :phone, :message, :email
def self.latest(number = 7, include_spam = false)
include_spam ? limit(number) : ham.limit(number)
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.