app/models/phcmemberspro/members/contact.rb in phcmemberspro-1.8.0 vs app/models/phcmemberspro/members/contact.rb in phcmemberspro-2.1.0
- old
+ new
@@ -1,13 +1,19 @@
module Phcmemberspro
class Members::Contact < ActiveRecord::Base
# Account Scope
- def self.scoped_to(account)
- where(:account_id => account.id)
- end
+ def self.scoped_to(account)
+ where(:account_id => account.id)
+ end
+ # Translate Country Code to Name
+ def mccountry
+ country = ISO3166::Country[country_code]
+ country.translations[I18n.locale.to_s] || country.name
+ end
+
# Model Relationships
belongs_to :main, class_name: 'Members::Main'
# Validation for Form Fields
validates :mccontactname,
@@ -23,10 +29,10 @@
length: { minimum: 3 }
validates :mcprovince,
presence: true,
length: { minimum: 2 }
-
+
validates :mccountry,
presence: true,
length: { minimum: 2 }
validates :mcpostalcode,