Sha256: 455b975273f11ffc580276184c4a8e345142aa07127ae629065ca925d2a92b7b

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

module PhcdevworksScripts
  class Script::Author < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

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

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

    # Form Fields Validation
    validates :script_author_first_name,
      presence: true

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

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

    def script_author_nice_urls
      [:script_author_first_name, :script_author_last_name]
    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/author.rb
phcdevworks_scripts-9.0.1 app/models/phcdevworks_scripts/script/author.rb
phcdevworks_scripts-9.0.0 app/models/phcdevworks_scripts/script/author.rb
phcdevworks_scripts-8.2.0 app/models/phcdevworks_scripts/script/author.rb