Sha256: c3cb842a56f79abdfbfa9cd25594968a8c2cf207258e22e6786db8e3e5ce4b55

Contents?: true

Size: 951 Bytes

Versions: 2

Compression:

Stored size: 951 Bytes

Contents

module Phcmemberspro
  class Member::Address < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Add Paper Trail
    has_paper_trail

    # Model Relationships
    belongs_to :profile, class_name: 'Phcmemberspro::Member::Profile'

    # Validation for Form Fields
    validates :mcaddressl1,
    presence: true,
    length: { minimum: 2 }

    validates :mccity,
    length: { minimum: 3 }

    validates :mcprovince,
    presence: true,
    length: { minimum: 2 }

    validates :mccountry,
    presence: true,
    length: { minimum: 2 }

    validates :mcpostalcode,
    presence: true,
    length: { minimum: 3 }

    validates :mctype,
    presence: true,
    length: { minimum: 2 }

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

    # Define for Multiple Records
    def phcmembers_address_slug
      [
        [:mcaddressl1, :mccity, :mcprovince]
      ]
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
phcmemberspro-21.0.0 app/models/phcmemberspro/member/address.rb
phcmemberspro-20.5.2 app/models/phcmemberspro/member/address.rb