Sha256: 89bc5cdf311db1c76150073e2dcd14444cefeab82c18f7e94d2219cb9127af9c

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

module Phcmembers
	class Member::Profile < ApplicationRecord

		# Clean URL Initialize
    extend FriendlyId

    # Add Paper Trail
    has_paper_trail :class_name => 'Phcmembers::ProfileVersions'

    # Gravatar
    include Gravtastic
    gravtastic :memail

    # Model Relationships
		has_many :addresses, class_name: 'Phcmembers::Member::Address'
		has_many :listings, class_name: 'Phcmembers::Member::Listing'

		# 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,
    length: { minimum: 6 }

    validates :mphone,
    presence: 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" }

		# Clean URL Define
		friendly_id :phcmembers_profiles_slug, use: [:slugged, :finders]

		# Define for Multiple Records
		def phcmembers_profiles_slug
			[
				[:mfirstname, :mlastname]
			]
		end

	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phcmembers-13.0.0 app/models/phcmembers/member/profile.rb
phcmembers-12.5.0 app/models/phcmembers/member/profile.rb
phcmembers-12.4.0 app/models/phcmembers/member/profile.rb