Sha256: 90731b6766da8e9f00a48e6e268495d8c88d2d3367a0e99cbbb46a5184a00858

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

module PhcdevworksScripts
  class Script::Listing < ApplicationRecord
  
    # Clean URL Initialize
    extend FriendlyId

    # Paper Trail Initialize
    has_paper_trail :class_name => 'PhcdevworksScripts::ListingVersions'

    # Relationships
    has_many :urls, class_name: 'PhcdevworksScripts::Script::Url', :dependent => :destroy
    belongs_to :author, class_name: 'PhcdevworksScripts::Script::Author'

    # Form Fields Validation
    validates :listing_title,
      presence: true

    validates :listing_description,
      presence: true

    validates :listing_script_source,
      format: { with: URI::regexp(%w(http https)), message: "Please follow this URL format http or https://www.**********.com" }

    validates :listing_script_website,
      format: { with: URI::regexp(%w(http https)), message: "Please follow this URL format http or https://www.**********.com" }

    validates :listing_script_repo,
      format: { with: URI::regexp(%w(http https)), message: "Please follow this URL format http or https://www.**********.com" }

    # Clean URL Define
    friendly_id :phc_nice_url_slug, use: [:slugged, :finders]

    def phc_nice_url_slug
      [:listing_title]
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phcdevworks_scripts-2.1.0 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-1.0.0 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-0.1.0 app/models/phcdevworks_scripts/script/listing.rb