Sha256: 701f288c74d2d0dbe609a0e3af8ab4cd521352badbd5e944f03ab6c7e37b542e

Contents?: true

Size: 792 Bytes

Versions: 1

Compression:

Stored size: 792 Bytes

Contents

module Phcpresspro
  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 :categories, class_name: 'Phcpresspro::Article::Category'

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

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

    validates :pststatus,
      presence: true

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

    # Define for Multiple Records
    def phcpresspro_post_slug
      [
        [:psttittle]
      ]
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
phcpresspro-70.0.0 app/models/phcpresspro/article/post.rb