Sha256: 197b2d447ce548f02adc8ad9281d43ddb163227aa1a2eafff1766e6a912b73b2

Contents?: true

Size: 1.04 KB

Versions: 10

Compression:

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

		def country_name
			country = ISO3166::Country[country_code]
			country.translations[I18n.locale.to_s] || country.mccountry
		end
	
	end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
phcmembers-61.0.0 app/models/phcmembers/member/address.rb
phcmembers-60.0.0 app/models/phcmembers/member/address.rb
phcmembers-59.0.0 app/models/phcmembers/member/address.rb
phcmembers-57.1.0 app/models/phcmembers/member/address.rb
phcmembers-57.0.0 app/models/phcmembers/member/address.rb
phcmembers-56.0.0 app/models/phcmembers/member/address.rb
phcmembers-55.0.0 app/models/phcmembers/member/address.rb
phcmembers-54.0.0 app/models/phcmembers/member/address.rb
phcmembers-53.0.0 app/models/phcmembers/member/address.rb
phcmembers-52.0.0 app/models/phcmembers/member/address.rb