Sha256: 2fcd93223e03b90d898b3b95e5557fc4db1461f229b4ea9cf6047882fe622f8e

Contents?: true

Size: 623 Bytes

Versions: 4

Compression:

Stored size: 623 Bytes

Contents

module Adminpanel
  class Contact
    include ActiveModel::Validations
    include ActiveModel::Conversion
    extend ActiveModel::Naming
    
    attr_accessor :name, :email, :subject, :body
    
    validates_presence_of :name
    validates_format_of :email, :with => /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}$/i
    validates_presence_of :email
    validates_presence_of :subject
    validates_presence_of :body

    def initialize(attributes = {})
      attributes.each do |name, value|
        send("#{name}=", value)
      end
    end
    
    def persisted?
      false
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
adminpanel-0.0.4 app/models/adminpanel/contact.rb
adminpanel-0.0.3 app/models/adminpanel/contact.rb
adminpanel-0.0.2 app/models/adminpanel/contact.rb
adminpanel-0.0.1 app/models/adminpanel/contact.rb