Sha256: f4b1093f81c1ebef4c8bdd62765042c6f755395b1284ae29b493a28c7f116f62

Contents?: true

Size: 930 Bytes

Versions: 38

Compression:

Stored size: 930 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 Initialize
    mount_uploader :pstimage, Phcpress::PstimageUploader

    # 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

38 entries across 38 versions & 1 rubygems

Version Path
phcpress-34.0.0 app/models/phcpress/article/post.rb
phcpress-33.0.0 app/models/phcpress/article/post.rb
phcpress-32.0.0 app/models/phcpress/article/post.rb
phcpress-31.2.0 app/models/phcpress/article/post.rb
phcpress-31.1.0 app/models/phcpress/article/post.rb
phcpress-31.0.0 app/models/phcpress/article/post.rb
phcpress-30.0.0 app/models/phcpress/article/post.rb
phcpress-29.0.0 app/models/phcpress/article/post.rb
phcpress-28.0.0 app/models/phcpress/article/post.rb
phcpress-27.0.0 app/models/phcpress/article/post.rb
phcpress-26.0.1 app/models/phcpress/article/post.rb
phcpress-26.0.0 app/models/phcpress/article/post.rb
phcpress-25.1.0 app/models/phcpress/article/post.rb
phcpress-25.0.0 app/models/phcpress/article/post.rb
phcpress-24.0.0 app/models/phcpress/article/post.rb
phcpress-23.2.0 app/models/phcpress/article/post.rb
phcpress-23.1.0 app/models/phcpress/article/post.rb
phcpress-23.0.0 app/models/phcpress/article/post.rb
phcpress-22.0.1 app/models/phcpress/article/post.rb
phcpress-22.0.0 app/models/phcpress/article/post.rb