Sha256: 472fed0b33baefd05bc5eba2c05315fb42da407c58227c832fc42bc454e1cd4a

Contents?: true

Size: 1.21 KB

Versions: 11

Compression:

Stored size: 1.21 KB

Contents

module Phcmembers
  class Member::Profile < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

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

    # Profile Gravatar
    include Gravtastic
    gravtastic :member_email

    # Relationships
    has_many :addresses, class_name: 'Phcmembers::Member::Address', :dependent => :destroy
    has_many :listings, class_name: 'Phcmembers::Member::Listing', :dependent => :destroy

    # Form Fields Validation
    validates :member_first_name,
      presence: true

    validates :member_last_name,
      presence: true

    validates :member_title,
      presence: true

    validates :member_email,
      presence: true,
      format: { with: /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/, message: "Please follow this Email format: *****@********.***" }

    validates :member_phone,
      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: ***-***-****" }

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

    def phc_nice_url_slug
      [
        [:member_first_name, :member_last_name]
      ]
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
phcmembers-68.0.3 app/models/phcmembers/member/profile.rb
phcmembers-68.0.2 app/models/phcmembers/member/profile.rb
phcmembers-68.0.1 app/models/phcmembers/member/profile.rb
phcmembers-68.0.0 app/models/phcmembers/member/profile.rb
phcmembers-67.5.0 app/models/phcmembers/member/profile.rb
phcmembers-67.4.0 app/models/phcmembers/member/profile.rb
phcmembers-67.3.0 app/models/phcmembers/member/profile.rb
phcmembers-67.1.0 app/models/phcmembers/member/profile.rb
phcmembers-67.0.0 app/models/phcmembers/member/profile.rb
phcmembers-66.0.0 app/models/phcmembers/member/profile.rb
phcmembers-65.0.0 app/models/phcmembers/member/profile.rb