Sha256: 9b4c13b8a5531f6b19cf0863666a48ec963b88cfba6dda76c58ad5a5b8125207

Contents?: true

Size: 893 Bytes

Versions: 9

Compression:

Stored size: 893 Bytes

Contents

module Phcpress
  class Article::Post < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Add Paper Trail
    has_paper_trail :class_name => 'Phcpress::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

9 entries across 9 versions & 1 rubygems

Version Path
phcpress-50.0.0 app/models/phcpress/article/post.rb
phcpress-49.0.0 app/models/phcpress/article/post.rb
phcpress-48.0.0 app/models/phcpress/article/post.rb
phcpress-47.1.0 app/models/phcpress/article/post.rb
phcpress-47.0.0 app/models/phcpress/article/post.rb
phcpress-46.0.0 app/models/phcpress/article/post.rb
phcpress-45.0.0 app/models/phcpress/article/post.rb
phcpress-44.0.0 app/models/phcpress/article/post.rb
phcpress-43.0.0 app/models/phcpress/article/post.rb