Sha256: dba80f7d66d3fba03e4077119e209f1fca15a629cd787f59baffb1e13734ad26

Contents?: true

Size: 863 Bytes

Versions: 1

Compression:

Stored size: 863 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 members_contact
			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

1 entries across 1 versions & 1 rubygems

Version Path
phcmemberspro-3.0.0 app/models/phcmemberspro/members/contact.rb