Sha256: fe7820b5350cfb147b07020a1f906a12c9d30e03caa62413edf59ed83b235f4a

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

module PhcdevworksMembers
  class Member::Profile < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Paper Trail Initialize
    has_paper_trail :class_name => 'PhcdevworksMembers::MemberProfileVersions'

    # Profile Gravatar
    include Gravtastic
    gravtastic :member_profile_email

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

    # Form Fields Validation
    validates :member_profile_first_name,
      presence: true

    validates :member_profile_last_name,
      presence: true

    validates :member_profile_title,
      presence: true

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

    validates :member_profile_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 :members_profile_nice_urls, use: [:slugged, :finders]

    def members_profile_nice_urls
      [
        [:member_profile_first_name, :member_profile_last_name]
      ]
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
phcdevworks_members-9.0.0 app/models/phcdevworks_members/member/profile.rb