Sha256: 07c97dcc9a319d9f88bca0da92387ce93cece5f6d81c613071d2f1519c1ce8dd

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

module Phcscriptcdn
  class Script::Listing < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Add Paper Trail
    has_paper_trail :class_name => 'Phcscriptcdn::ListingVersions'

    # Relationships
    has_many :urls, class_name: 'Phcscriptcdn::Script::Url'
    belongs_to :author, class_name: 'Phcscriptcdn::Script::Author'
    belongs_to :licence, class_name: 'Phcscriptcdn::Script::Licence'

    # Validation for Form Fields
    validates :script_tittle,
      presence: true,
      length: { minimum: 3 }

    validates :script_description,
      presence: true,
      length: { minimum: 4 }

    validates :script_source,
      length: { minimum: 5 }

     validates :script_website,
      length: { minimum: 5 }

    validates :script_github,
      length: { minimum: 5 }

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

    # Define for Multiple Records
    def phcscriptcdn_listing_slug
      [
        [:script_tittle]
      ]
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
phcscriptcdn-50.0.0 app/models/phcscriptcdn/script/listing.rb