Sha256: 4afb7aae08a7029ecb134459d113f8fd49f9a74fd00769ee0f89009c5215975a
Contents?: true
Size: 1.83 KB
Versions: 1
Compression:
Stored size: 1.83 KB
Contents
module Phcmemberspro class Member::Listing < ApplicationRecord # Clean URL Initialize extend FriendlyId # Add Paper Trail has_paper_trail :class_name => 'Phcmemberspro::ListingVersions' # Model Relationships belongs_to :profile, class_name: 'Phcmemberspro::Member::Profile' has_and_belongs_to_many :categories, class_name: 'Phcmemberspro::Directory::Category', :join_table => 'categories_listings' # Validation for Form Fields validates :listing_companyname, presence: true, length: { minimum: 2 } validates :listing_contactname, presence: true, length: { minimum: 2 } validates :listing_addressl1, length: { minimum: 3 } validates :listing_city, presence: true, length: { minimum: 3 } validates :listing_country, presence: true, length: { minimum: 2 } validates :listing_province, presence: true, length: { minimum: 2 } validates :listing_postalcode, presence: true, length: { minimum: 3 } validates :listing_contactemail, presence: true, length: { minimum: 3 }, format: { with: /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/, message: "Please follow this Email format: *****@********.***" } validates :listing_website, presence: true, length: { minimum: 6 } validates :listing_phone, presence: true, format: { with: /\A(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}\z/, message: "Please Follow this Phone Member Format: ***-***-****" } # Clean URL Define friendly_id :phcmelisting_erspro_listings_slug, use: [:slugged, :finders] # Define for Multiple Records def phcmelisting_erspro_listings_slug [ [:org_id, :listing_companyname, :listing_contactname, :listing_addressl1] ] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
phcmemberspro-86.0.0 | app/models/phcmemberspro/member/listing.rb |