contact.rb 538 B

123456789101112131415
  1. # Contacts are used only for the contact form on the Huginn website. If you host a public Huginn instance, you can use
  2. # these to receive messages from visitors.
  3. class Contact < ActiveRecord::Base
  4. attr_accessible :email, :message, :name
  5. validates_format_of :email, :with => /\A[A-Z0-9._%+-]+@[A-Z0-9.-]+\.(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)\Z/i
  6. validates_presence_of :name, :message
  7. after_create :send_contact
  8. def send_contact
  9. ContactMailer.send_contact(self).deliver
  10. end
  11. end