Sha256: 089dd2a4acb0791da40ba456a8391b9c62e01c28578980c5de9ff041de8b3591

Contents?: true

Size: 860 Bytes

Versions: 91

Compression:

Stored size: 860 Bytes

Contents

module Phcmemberspro
	class Members::Contact < ActiveRecord::Base

		# Account Scope
		def self.scoped_to(account)
			where(:account_id => account.id)
		end

		# Translate Country Code to Name
		def country_name
			country = ISO3166::Country[mccountry]
			country.translations[I18n.locale.to_s] || country.name
		end

		# Model Relationships
		belongs_to :main, class_name: 'Members::Main'

		# Validation for Form Fields
		validates :mccontactname,
			presence: true,
			length: { minimum: 3 }

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

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

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

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

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

	end
end

Version data entries

91 entries across 91 versions & 1 rubygems

Version Path
phcmemberspro-5.0.0 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.11.2 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.11.1 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.11.0 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.10.10 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.10.9 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.10.8 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.10.7 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.10.6 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.10.5 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.10.4 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.10.3 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.10.2 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.10.1 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.10.0 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.9.9 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.9.8 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.9.7 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.9.6 app/models/phcmemberspro/members/contact.rb
phcmemberspro-4.9.5 app/models/phcmemberspro/members/contact.rb