Sha256: e8318099915bbc9123a798b9246fe2109995a22a7822f8ea882eb36a575a0cff

Contents?: true

Size: 1.04 KB

Versions: 52

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

52 entries across 52 versions & 1 rubygems

Version Path
phcmembers-51.0.0 app/models/phcmembers/member/address.rb
phcmembers-50.0.0 app/models/phcmembers/member/address.rb
phcmembers-49.0.0 app/models/phcmembers/member/address.rb
phcmembers-46.0.0 app/models/phcmembers/member/address.rb
phcmembers-45.0.0 app/models/phcmembers/member/address.rb
phcmembers-44.0.0 app/models/phcmembers/member/address.rb
phcmembers-43.0.0 app/models/phcmembers/member/address.rb
phcmembers-42.0.0 app/models/phcmembers/member/address.rb
phcmembers-41.0.0 app/models/phcmembers/member/address.rb
phcmembers-40.0.0 app/models/phcmembers/member/address.rb
phcmembers-39.2.0 app/models/phcmembers/member/address.rb
phcmembers-39.1.0 app/models/phcmembers/member/address.rb
phcmembers-39.0.0 app/models/phcmembers/member/address.rb
phcmembers-38.0.0 app/models/phcmembers/member/address.rb
phcmembers-37.0.0 app/models/phcmembers/member/address.rb
phcmembers-36.0.0 app/models/phcmembers/member/address.rb
phcmembers-35.0.0 app/models/phcmembers/member/address.rb
phcmembers-34.0.1 app/models/phcmembers/member/address.rb
phcmembers-33.1.0 app/models/phcmembers/member/address.rb
phcmembers-33.0.0 app/models/phcmembers/member/address.rb