Sha256: ed5109c64a2850ca144670899186cfdb6c08792e37d21a3411bafc4674acc651

Contents?: true

Size: 1.21 KB

Versions: 12

Compression:

Stored size: 1.21 KB

Contents

module Phcscriptcdnpro
  class Script::Listing < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

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

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

    # Form Fields Validation
    validates :script_title,
      presence: true

    validates :script_description,
      presence: true

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

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

    validates :script_github,
      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
      [:script_title]
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
phcscriptcdnpro-79.0.3 app/models/phcscriptcdnpro/script/listing.rb
phcscriptcdnpro-79.0.2 app/models/phcscriptcdnpro/script/listing.rb
phcscriptcdnpro-79.0.1 app/models/phcscriptcdnpro/script/listing.rb
phcscriptcdnpro-79.0.0 app/models/phcscriptcdnpro/script/listing.rb
phcscriptcdnpro-78.4.0 app/models/phcscriptcdnpro/script/listing.rb
phcscriptcdnpro-78.3.0 app/models/phcscriptcdnpro/script/listing.rb
phcscriptcdnpro-78.2.0 app/models/phcscriptcdnpro/script/listing.rb
phcscriptcdnpro-78.1.0 app/models/phcscriptcdnpro/script/listing.rb
phcscriptcdnpro-78.0.0 app/models/phcscriptcdnpro/script/listing.rb
phcscriptcdnpro-77.0.0 app/models/phcscriptcdnpro/script/listing.rb
phcscriptcdnpro-75.0.0 app/models/phcscriptcdnpro/script/listing.rb
phcscriptcdnpro-74.0.0 app/models/phcscriptcdnpro/script/listing.rb