Sha256: 54f6d0d0001305653512c40e9da2c8b68b2aaff90bab026ae9317bcdc3815990

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 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

4 entries across 4 versions & 1 rubygems

Version Path
phcdevworks_members-12.0.2 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-12.0.1 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-12.0.0 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-11.2.0 app/models/phcdevworks_members/member/profile.rb