Sha256: a92edfc6b10be8e5e7707b27a9385b1681574b9ad80f6921c5251f0f56c9dea6

Contents?: true

Size: 1.32 KB

Versions: 9

Compression:

Stored size: 1.32 KB

Contents

module Phcmemberspro
  class Member::Listing < ApplicationRecord

    # Add Paper Trail
    has_paper_trail

    # Model Relationships
    belongs_to :profile, class_name: 'Phcmemberspro::Member::Profile'
    has_many :categorylistings, class_name: 'Phcmemberspro::Directory::Categorylisting', dependent: :destroy
    has_many :categories, class_name: 'Phcmemberspro::Directory::Category', :through => :categorylistings

    # Validation for Form Fields
    validates :mbcompanyname,
      presence: true,
      length: { minimum: 2 }

    validates :mbcontactname,
      presence: true,
      length: { minimum: 2 }

    validates :mbaddressl1,
      length: { minimum: 3 }

    validates :mbcity,
      presence: true,
      length: { minimum: 3 }

    validates :mbcountry,
      presence: true,
      length: { minimum: 2 }

    validates :mbprovince,
      presence: true,
      length: { minimum: 2 }

    validates :mbpostalcode,
      presence: true,
      length: { minimum: 3 }

    validates :mbcontactemail,
      presence: true,
      length: { minimum: 3 }

    validates :mbwebsite,
      presence: true,
      length: { minimum: 6 }

    validates :mbphone,
      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" }

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
phcmemberspro-20.0.4 app/models/phcmemberspro/member/listing.rb
phcmemberspro-20.0.3 app/models/phcmemberspro/member/listing.rb
phcmemberspro-20.0.2 app/models/phcmemberspro/member/listing.rb
phcmemberspro-20.0.1 app/models/phcmemberspro/member/listing.rb
phcmemberspro-20.0.0 app/models/phcmemberspro/member/listing.rb
phcmemberspro-19.0.1 app/models/phcmemberspro/member/listing.rb
phcmemberspro-19.0.0 app/models/phcmemberspro/member/listing.rb
phcmemberspro-18.0.1 app/models/phcmemberspro/member/listing.rb
phcmemberspro-18.0.0 app/models/phcmemberspro/member/listing.rb