Sha256: 60f03e178d37b907560eb18120e9e0905d10d888d76aad49a6f6971995ddcaa7

Contents?: true

Size: 1.21 KB

Versions: 15

Compression:

Stored size: 1.21 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 :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 :phcdev_script_listing_nice_urls, use: [:slugged, :finders]

    def phcdev_script_listing_nice_urls
      [:listing_title]
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
phcdevworks_scripts-5.8.0 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-5.7.1 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-5.7.0 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-5.6.0 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-5.5.0 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-5.4.0 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-5.3.0 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-5.2.0 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-5.1.0 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-5.0.0 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-4.1.1 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-4.1.0 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-4.0.2 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-4.0.1 app/models/phcdevworks_scripts/script/listing.rb
phcdevworks_scripts-4.0.0 app/models/phcdevworks_scripts/script/listing.rb