Sha256: f550abc0a921112e7934e10f0a0d53df212a787f71d54ea0b17270a1a9555e74

Contents?: true

Size: 1.28 KB

Versions: 4

Compression:

Stored size: 1.28 KB

Contents

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

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

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

    # Form Fields Validation
    validates :script_listing_title,
      presence: true

    validates :script_listing_description,
      presence: true

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

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

    validates :script_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 :script_listing_nice_urls, use: [:slugged, :finders]

    def script_listing_nice_urls
      [:script_listing_title]
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phcdevworks_scripts-9.0.2 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-9.0.1 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-9.0.0 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-8.2.0 app/models/phcdevworks_scripts/script/listing.rb