Sha256: cd663518eb4810e550869ba6d3db236a26664fe8196016c3ed6d6aa01a2debd2

Contents?: true

Size: 899 Bytes

Versions: 4

Compression:

Stored size: 899 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_and_belongs_to_many :categories, class_name: 'Phcpresspro::Article::Category', :join_table => 'categories_posts'
    belongs_to :user, class_name: 'Phcaccountspro::User'

    # 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

4 entries across 4 versions & 1 rubygems

Version Path
phcpresspro-81.0.0 app/models/phcpresspro/article/post.rb
phcpresspro-80.3.0 app/models/phcpresspro/article/post.rb
phcpresspro-80.2.0 app/models/phcpresspro/article/post.rb
phcpresspro-80.1.0 app/models/phcpresspro/article/post.rb