Sha256: 7708f4ea7bb4f4f29e84ae2a7a63442a076b07497000452fccfaf77b3514cb80

Contents?: true

Size: 942 Bytes

Versions: 2

Compression:

Stored size: 942 Bytes

Contents

module Phcmembers
	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 :listings, class_name: 'Directory::Listing'
		has_many :categories, class_name: 'Directory::Category', :through => :listings
		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

2 entries across 2 versions & 1 rubygems

Version Path
phcmembers-3.0.1 app/models/phcmembers/members/business.rb
phcmembers-3.0.0 app/models/phcmembers/members/business.rb