Sha256: be6ec6538684874567a946006cf358cea01e4da24f663729dd0ba220bab3c583

Contents?: true

Size: 1000 Bytes

Versions: 6

Compression:

Stored size: 1000 Bytes

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: "PhcdevworksAccounts::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

6 entries across 6 versions & 1 rubygems

Version Path
phcdevworks_core_modules-7.2.2 app/models/phcdevworks_core_modules/affiliate/link.rb
phcdevworks_core_modules-7.2.1 app/models/phcdevworks_core_modules/affiliate/link.rb
phcdevworks_core_modules-7.2.0 app/models/phcdevworks_core_modules/affiliate/link.rb
phcdevworks_core_modules-7.1.4 app/models/phcdevworks_core_modules/affiliate/link.rb
phcdevworks_core_modules-7.1.3 app/models/phcdevworks_core_modules/affiliate/link.rb
phcdevworks_core_modules-7.1.2 app/models/phcdevworks_core_modules/affiliate/link.rb