Sha256: e4004ffd3e0ec1eafa103d07035fe7658d6e7c5fe751d35d3b9acd7ae8db64ae
Contents?: true
Size: 1.2 KB
Versions: 10
Compression:
Stored size: 1.2 KB
Contents
module Phcscriptcdn class Script::Listing < ApplicationRecord # Clean URL Initialize extend FriendlyId # Paper Trail Initialize has_paper_trail :class_name => 'Phcscriptcdn::ListingVersions' # Relationships has_many :urls, class_name: 'Phcscriptcdn::Script::Url', :dependent => :destroy belongs_to :author, class_name: 'Phcscriptcdn::Script::Author' belongs_to :licence, class_name: 'Phcscriptcdn::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
10 entries across 10 versions & 1 rubygems