Sha256: 9eccbfc37d9fbac54b6b1192c7b9333f8fbd2275c0281e50bcf756221d095009

Contents?: true

Size: 848 Bytes

Versions: 46

Compression:

Stored size: 848 Bytes

Contents

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

		# Account 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

46 entries across 46 versions & 1 rubygems

Version Path
phcmemberspro-3.1.0 app/models/phcmemberspro/members/main.rb
phcmemberspro-3.0.9 app/models/phcmemberspro/members/main.rb
phcmemberspro-3.0.8 app/models/phcmemberspro/members/main.rb
phcmemberspro-3.0.6 app/models/phcmemberspro/members/main.rb
phcmemberspro-3.0.5 app/models/phcmemberspro/members/main.rb
phcmemberspro-3.0.4 app/models/phcmemberspro/members/main.rb
phcmemberspro-3.0.3 app/models/phcmemberspro/members/main.rb
phcmemberspro-3.0.2 app/models/phcmemberspro/members/main.rb
phcmemberspro-3.0.1 app/models/phcmemberspro/members/main.rb
phcmemberspro-3.0.0 app/models/phcmemberspro/members/main.rb
phcmemberspro-2.2.8 app/models/phcmemberspro/members/main.rb
phcmemberspro-2.2.7 app/models/phcmemberspro/members/main.rb
phcmemberspro-2.2.6 app/models/phcmemberspro/members/main.rb
phcmemberspro-2.2.5 app/models/phcmemberspro/members/main.rb
phcmemberspro-2.2.4 app/models/phcmemberspro/members/main.rb
phcmemberspro-2.2.3 app/models/phcmemberspro/members/main.rb
phcmemberspro-2.2.1 app/models/phcmemberspro/members/main.rb
phcmemberspro-2.2.0 app/models/phcmemberspro/members/main.rb
phcmemberspro-2.1.9 app/models/phcmemberspro/members/main.rb
phcmemberspro-2.1.8 app/models/phcmemberspro/members/main.rb