Sha256: 84a3ac2641497d6b948342edbaadae50ba2111793f3a0e76a857224866f924cd

Contents?: true

Size: 810 Bytes

Versions: 5

Compression:

Stored size: 810 Bytes

Contents

module Phcmembers
	class Members::Main < ActiveRecord::Base

		# Gravatar
		include Gravtastic
		gravtastic :memail

		# Model Relationship
		has_many :listings, class_name: 'Members::Listing', dependent: :destroy
		has_many :contacts, class_name: 'Members::Contact', dependent: :destroy

		# Validation for Form Fields
		validates :mfirstname,
			presence: true,
			length: { minimum: 1 }

		validates :mlastname,
			presence: true,
			length: { minimum: 1 }

		validates :mtitle,
			length: { minimum: 2 }

		validates :memail,
			presence: true,
			uniqueness: true,
			length: { minimum: 6 }

		validates :mphone,
			presence: true,
			uniqueness: true,
			format: { with: /\A(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}\z/, message: "Please Follow this Phone Number Format: xxx-xxx-xxxx" }

	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
phcmembers-2.2.0 app/models/phcmembers/members/main.rb
phcmembers-2.1.3 app/models/phcmembers/members/main.rb
phcmembers-2.1.2 app/models/phcmembers/members/main.rb
phcmembers-2.1.1 app/models/phcmembers/members/main.rb
phcmembers-2.1.0 app/models/phcmembers/members/main.rb