Sha256: d649417f3cbd4ec6e2da6d5755ff0428da9ca27ee96e95b8f7a56756c2194755

Contents?: true

Size: 724 Bytes

Versions: 7

Compression:

Stored size: 724 Bytes

Contents

module Phcpress
  class Article::Post < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Paper Trail Initialize
    has_paper_trail :class_name => 'Phcpress::PostVersions'

    # Image Upload
    has_one_attached :post_image

    # Relationships
    has_and_belongs_to_many :categories, class_name: 'Phcpress::Article::Category', :join_table => 'categories_posts'
    belongs_to :user, class_name: 'Phcaccounts::User'

    # Form Fields Validation
    validates :post_title,
      presence: true

    validates :post_text,
      presence: true

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

    def phcpress_post_slug
      [:post_title]
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
phcpress-56.4.0 app/models/phcpress/article/post.rb
phcpress-56.3.0 app/models/phcpress/article/post.rb
phcpress-56.2.0 app/models/phcpress/article/post.rb
phcpress-56.1.0 app/models/phcpress/article/post.rb
phcpress-56.0.0 app/models/phcpress/article/post.rb
phcpress-55.0.0 app/models/phcpress/article/post.rb
phcpress-54.0.0 app/models/phcpress/article/post.rb