Sha256: 1b42c6f6090370c3cf653dec9b0fae6b80027991a6715c04cd90e588a27b15a0

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

module PhcdevworksCoreModules
  class Affiliate::Link < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Validations
    validates :affiliate_link_name, presence: true
    validates :affiliate_link_button_text, presence: false
    validates :affiliate_link_url, presence: true
    validates :affiliate_link_original_url, presence: false



    # Paper Trail Initialize
    has_paper_trail versions: {class_name: "PhcdevworksCoreModules::AffiliateLinkVersions"}

    # Relationships for Local
    belongs_to :user, class_name: "PhcdevworksAccountsDevise::User"

    if defined?phcdevworks_press
      has_many :posts, class_name: "PhcdevworksPress::Article::Post"
      has_many :posts, class_name: "PhcdevworksPress::Review::Post"
      has_many :posts, class_name: "PhcdevworksPress::List::Post"
    end

    # Clean URL Define
    friendly_id :affiliate_link_nice_urls, use: [:slugged, :finders]

    def affiliate_link_nice_urls
      [:affiliate_link_name]
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phcdevworks_core_modules-8.0.3 app/models/phcdevworks_core_modules/affiliate/link.rb
phcdevworks_core_modules-8.0.2 app/models/phcdevworks_core_modules/affiliate/link.rb
phcdevworks_core_modules-8.0.1 app/models/phcdevworks_core_modules/affiliate/link.rb
phcdevworks_core_modules-8.0.0 app/models/phcdevworks_core_modules/affiliate/link.rb