Sha256: e56f16d970811f90e427644350aafdcbe017e4989e6b792b03bcd373ff191ee2

Contents?: true

Size: 691 Bytes

Versions: 2

Compression:

Stored size: 691 Bytes

Contents

class Inquiry < ActiveRecord::Base

  filters_spam :message_field => :message,
               :email_field => :email,
               :author_field => :name,
               :other_fields => [:phone],
               :extra_spam_words => %w()

  validates :name, :presence => true
  validates :message, :presence => true
  validates :email, :format=> { :with =>  /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i }

  acts_as_indexed :fields => [:name, :email, :message, :phone]

  default_scope :order => 'created_at DESC' # previously scope :newest

  def self.latest(number = 7, include_spam = false)
    unless include_spam
      ham.limit(number)
    else
      limit(number)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
refinerycms-inquiries-0.9.9.2 app/models/inquiry.rb
refinerycms-inquiries-0.9.9.1 app/models/inquiry.rb