module Phcscriptcdnpro class Script::Url < ApplicationRecord # Clean URL Initialize extend FriendlyId # Add Paper Trail has_paper_trail :class_name => 'Phcscriptcdnpro::UrlVersions' # Relationships belongs_to :listing, class_name: 'Phcscriptcdnpro::Script::Listing' belongs_to :version, class_name: 'Phcscriptcdnpro::Script::Version', optional: true belongs_to :extension, class_name: 'Phcscriptcdnpro::Script::Extension', optional: true # Validation for Form Fields validates :scripturl, presence: true validates :scripturlrelease, presence: true validates :scripturlcdnupdate, presence: true # Clean URL Define friendly_id :phcscriptcdnpro_url_slug, use: [:slugged, :finders] # Define for Multiple Records def phcscriptcdnpro_url_slug [ [:scripturl] ] end end end