Sha256: b5a5059d39439f3ee22e4172014dce6f299dca231095958765130c9091988e06

Contents?: true

Size: 1.28 KB

Versions: 22

Compression:

Stored size: 1.28 KB

Contents

module Phcmemberspro
  class Member::Profile < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

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

    # Gravatar
    include Gravtastic
    gravtastic :memail

    # Model Relationships
    has_many :addresses, class_name: 'Phcmemberspro::Member::Address'
    has_many :listings, class_name: 'Phcmemberspro::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 },
      format: { with: /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/, message: "Please follow this Email format: *****@********.***" }

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

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

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

  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
phcmemberspro-35.0.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-34.0.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-33.0.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-32.0.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-31.0.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-30.0.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-29.2.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-29.1.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-29.0.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-28.0.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-27.2.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-27.1.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-27.0.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-26.0.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-25.1.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-25.0.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-24.2.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-24.1.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-24.0.0 app/models/phcmemberspro/member/profile.rb
phcmemberspro-23.1.0 app/models/phcmemberspro/member/profile.rb