Sha256: e0e033986cce0de42a18c82eedb6f7283556fbdd4955cad8619bd84588ef6441

Contents?: true

Size: 573 Bytes

Versions: 4

Compression:

Stored size: 573 Bytes

Contents

class ContactUs::Contact
  include ActiveModel::Validations

  validates_presence_of :email, :message

  # to deal with form, you must have an id attribute
  attr_accessor :id, :email, :message

  def initialize(attributes = {})
    attributes.each do |key, value|
      self.send("#{key}=", value)
    end
    @attributes = attributes
  end

  def read_attribute_for_validation(key)
    @attributes[key]
  end

  def to_key; end

  def save
    if self.valid?
      ContactUs::ContactMailer.contact_email(self).deliver
      return true
    end
    return false
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
contact_us-0.0.7 app/models/contact_us/contact.rb
contact_us-0.0.6 app/models/contact_us/contact.rb
contact_us-0.0.5 app/models/contact_us/contact.rb
contact_us-0.0.4 app/models/contact_us/contact.rb