Sha256: 320ba2a9f091ab7edc9ecf47dacf8bc0fa551a6724a3eb4cf78a416495b6aba7

Contents?: true

Size: 846 Bytes

Versions: 7

Compression:

Stored size: 846 Bytes

Contents

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

		# Mtdevise Scope
		def self.scoped_to(account)
			where(:account_id => account.id)
		end

		# 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

7 entries across 7 versions & 1 rubygems

Version Path
phcmembers-0.9.6 app/models/phcmembers/members/main.rb
phcmembers-0.8.0 app/models/phcmembers/members/main.rb
phcmembers-0.6.2 app/models/phcmembers/members/main.rb
phcmembers-0.6.1 app/models/phcmembers/members/main.rb
phcmembers-0.6.0 app/models/phcmembers/members/main.rb
phcmembers-0.5.9 app/models/phcmembers/members/main.rb
phcmembers-0.5.8 app/models/phcmembers/members/main.rb