Sha256: 70c5d3cf506608a1021f443c1620ee5b0cfd3784622611663b2f4320df995f18

Contents?: true

Size: 1.25 KB

Versions: 18

Compression:

Stored size: 1.25 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 :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 :profile_first_name,
      presence: true

    validates :profile_last_name,
      presence: true

    validates :profile_title,
      presence: true

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

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

    def phcdev_members_profile_nice_urls
      [
        [:profile_first_name, :profile_last_name]
      ]
    end

  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
phcdevworks_members-8.0.0 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-7.0.0 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-6.8.0 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-6.7.1 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-6.7.0 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-6.6.0 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-6.5.0 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-6.4.0 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-6.3.0 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-6.2.0 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-6.1.0 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-6.0.0 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-5.1.1 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-5.1.0 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-5.0.3 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-5.0.2 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-5.0.0 app/models/phcdevworks_members/member/profile.rb
phcdevworks_members-4.1.0 app/models/phcdevworks_members/member/profile.rb