Sha256: fd6e73e426b345848f1fbf013e8d32715b74ecfcdf82f556ed7163b1b99bdf4b

Contents?: true

Size: 917 Bytes

Versions: 14

Compression:

Stored size: 917 Bytes

Contents

module Phcmemberspro
	class Members::Business < 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'
		has_many :catlists, class_name: 'Directory::Catlist'

		# 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

14 entries across 14 versions & 1 rubygems

Version Path
phcmemberspro-5.3.9 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.3.8 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.3.7 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.3.6 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.3.5 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.3.4 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.3.2 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.3.1 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.2.7 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.2.6 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.2.5 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.2.4 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.2.3 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.2.2 app/models/phcmemberspro/members/business.rb