Sha256: 7ea752b395c031b503c0133b5e81530a02bc2f919830b70cf2cc84d8ae3e64b5

Contents?: true

Size: 926 Bytes

Versions: 10

Compression:

Stored size: 926 Bytes

Contents

module Phcscriptcdn
  class Script::Author < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Paper Trail Initialize
    has_paper_trail :class_name => 'Phcscriptcdn::AuthorVersions'

    # Relationships
    has_many :listings, class_name: 'Phcscriptcdn::Script::Listing'

    # Form Fields Validation
    validates :author_first_name,
      presence: true

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

    validates :author_github,
      presence: true,
      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
      [:author_first_name, :author_last_name]
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
phcscriptcdn-55.0.3 app/models/phcscriptcdn/script/author.rb
phcscriptcdn-55.0.2 app/models/phcscriptcdn/script/author.rb
phcscriptcdn-55.0.1 app/models/phcscriptcdn/script/author.rb
phcscriptcdn-55.0.0 app/models/phcscriptcdn/script/author.rb
phcscriptcdn-54.3.0 app/models/phcscriptcdn/script/author.rb
phcscriptcdn-54.2.0 app/models/phcscriptcdn/script/author.rb
phcscriptcdn-54.1.0 app/models/phcscriptcdn/script/author.rb
phcscriptcdn-54.0.0 app/models/phcscriptcdn/script/author.rb
phcscriptcdn-53.0.0 app/models/phcscriptcdn/script/author.rb
phcscriptcdn-52.0.0 app/models/phcscriptcdn/script/author.rb