Sha256: d5914b72ba34f50ba872d8fd9bdb38a8b2e47991cbf77636b0f3738944cc787f

Contents?: true

Size: 981 Bytes

Versions: 12

Compression:

Stored size: 981 Bytes

Contents

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

		# Add Paper Trail
		has_paper_trail

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

		# Model Relationship
		has_many :mains, class_name: 'Directory::Main', dependent: :destroy
		has_many :categories, class_name: 'Directory::Category', :through => :listings, dependent: :destroy
		belongs_to :main, class_name: 'Members::Main'

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

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

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

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

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

		validates :mbpostalcode,
			presence: true,
			length: { minimum: 6 }
 
	end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
phcmemberspro-6.8.10 app/models/phcmemberspro/members/business.rb
phcmemberspro-6.8.9 app/models/phcmemberspro/members/business.rb
phcmemberspro-6.8.8 app/models/phcmemberspro/members/business.rb
phcmemberspro-6.8.7 app/models/phcmemberspro/members/business.rb
phcmemberspro-6.8.6 app/models/phcmemberspro/members/business.rb
phcmemberspro-6.8.5 app/models/phcmemberspro/members/business.rb
phcmemberspro-6.8.4 app/models/phcmemberspro/members/business.rb
phcmemberspro-6.8.3 app/models/phcmemberspro/members/business.rb
phcmemberspro-6.8.2 app/models/phcmemberspro/members/business.rb
phcmemberspro-6.8.1 app/models/phcmemberspro/members/business.rb
phcmemberspro-6.8.0 app/models/phcmemberspro/members/business.rb
phcmemberspro-6.7.6 app/models/phcmemberspro/members/business.rb