Sha256: a6b3b2239e521bd73f173d0377a952507fd8434f809685a54fdefe3db4d09909

Contents?: true

Size: 896 Bytes

Versions: 8

Compression:

Stored size: 896 Bytes

Contents

module Phcpress
  class Article::Post < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Add Paper Trail
    has_paper_trail :class_name => 'Phcpresspro::PostVersions'

    # Image Upload
    has_one_attached :pstimage

    # Model Relationships
    has_many :connections, class_name: 'Phcpress::Modules::Connection', dependent: :destroy
    has_many :categories, class_name: 'Phcpress::Modules::Category', :through => :connections

    # Validation for Form Fields
    validates :psttitle,
      presence: true,
      length: { minimum: 3 }

    validates :psttext,
      presence: true,
      length: { minimum: 3 }

    validates :pststatus,
      presence: true

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

    # Define for Multiple Records
    def phcpress_post_slug
      [
        [:psttitle]
      ]
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
phcpress-42.0.0 app/models/phcpress/article/post.rb
phcpress-41.0.0 app/models/phcpress/article/post.rb
phcpress-40.0.0 app/models/phcpress/article/post.rb
phcpress-39.0.0 app/models/phcpress/article/post.rb
phcpress-38.0.0 app/models/phcpress/article/post.rb
phcpress-37.0.0 app/models/phcpress/article/post.rb
phcpress-36.0.0 app/models/phcpress/article/post.rb
phcpress-35.0.0 app/models/phcpress/article/post.rb