Sha256: 3b4122736870cbc9c7d0ffa8d41a1ae75b3d6ec8369321fd0260eab98c9af3e8

Contents?: true

Size: 552 Bytes

Versions: 11

Compression:

Stored size: 552 Bytes

Contents

class Contact
  include ActiveModel::Validations
  include ActiveModel::Conversion
  extend ActiveModel::Naming

  attr_accessor :name, :email, :phone, :content, :subject
  
  # open up everything for mass assignment
  attr_protected

  validates_presence_of :name
  validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
  validates_length_of :content, :maximum => 500

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

  def persisted?
    false
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
forge-cli-0.1.10 lib/forge/app/models/contact.rb
forge-cli-0.1.9 lib/forge/app/models/contact.rb
forge-cli-0.1.8 lib/forge/app/models/contact.rb
forge-cli-0.1.7 lib/forge/app/models/contact.rb
forge-cli-0.1.6 lib/forge/app/models/contact.rb
forge-cli-0.1.5 lib/forge/app/models/contact.rb
forge-cli-0.1.4 lib/forge/app/models/contact.rb
forge-cli-0.1.3 lib/forge/app/models/contact.rb
forge-cli-0.1.2 lib/forge/app/models/contact.rb
forge-cli-0.1.1 lib/forge/app/models/contact.rb
forge-cli-0.1.0 lib/forge/app/models/contact.rb