Sha256: fb4165bbc44454782e94cd4bae37ff0b2652ee3a00bcf8794154ed47dfa86c82
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
module Phcmemberspro class Members::Listing < 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[mlcountry] 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', dependent: :destroy before_create :listing_country_name # Validation for Form Fields validates :mlcontactname, presence: true, length: { minimum: 3 } validates :mlcompanyname, presence: true, length: { minimum: 2 } validates :mlcity, presence: true, length: { minimum: 3 } validates :mlprovince, presence: true, length: { minimum: 2 } validates :mlpostalcode, presence: true, length: { minimum: 6 } validates :mlcountry, presence: true, length: { minimum: 2 } validates :mlphone, presence: true, format: { with: /\A(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}\z/, message: "Please Follow this Phone Number Format: xxx-xxx-xxxx" } validates :mlwebsite, presence: true, length: { minimum: 3 } end end
Version data entries
3 entries across 3 versions & 1 rubygems