Sha256: d4e81015757dd723360fb788ee42c52b4bef4a99be79648f7412e7af2e4a7f87

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

module Phcmembers
  class Member::Address < ApplicationRecord

		# Clean URL Initialize
		extend FriendlyId

		# Add Paper Trail
		has_paper_trail :class_name => 'Phcmembers::AddressVersions'

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

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

    validates :address_city,
      length: { minimum: 3 }

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

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

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

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

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

		# Define for Multiple Records
		def phcmembers_address_slug
			[
				[:address_city, :address_province, :address_type]
			]
		end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phcmembers-64.1.0 app/models/phcmembers/member/address.rb
phcmembers-64.0.0 app/models/phcmembers/member/address.rb
phcmembers-63.0.0 app/models/phcmembers/member/address.rb