Sha256: e0b1e0d77599695c9e728c649c0b8ff1e4ed265d03534a252096f99e7da64e3a

Contents?: true

Size: 862 Bytes

Versions: 14

Compression:

Stored size: 862 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'

		# 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.2.1 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.2.0 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.1.5 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.1.4 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.1.3 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.1.2 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.1.1 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.1.0 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.0.6 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.0.5 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.0.4 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.0.3 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.0.2 app/models/phcmemberspro/members/business.rb
phcmemberspro-5.0.1 app/models/phcmemberspro/members/business.rb