Sha256: a193c9283cb246a3f90de854f1e7ef3f30296bc238a939b8cea9f723710ebd86

Contents?: true

Size: 736 Bytes

Versions: 8

Compression:

Stored size: 736 Bytes

Contents

module Phcpresspro
  class Article::Post < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

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

    # Image Upload
    has_one_attached :post_image

    # Relationships
    has_and_belongs_to_many :categories, class_name: 'Phcpresspro::Article::Category', :join_table => 'categories_posts'
    belongs_to :user, class_name: 'Phcaccountspro::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

8 entries across 8 versions & 1 rubygems

Version Path
phcpresspro-86.4.0 app/models/phcpresspro/article/post.rb
phcpresspro-86.3.0 app/models/phcpresspro/article/post.rb
phcpresspro-86.2.0 app/models/phcpresspro/article/post.rb
phcpresspro-86.1.0 app/models/phcpresspro/article/post.rb
phcpresspro-86.0.0 app/models/phcpresspro/article/post.rb
phcpresspro-85.0.0 app/models/phcpresspro/article/post.rb
phcpresspro-84.0.0 app/models/phcpresspro/article/post.rb
phcpresspro-83.0.0 app/models/phcpresspro/article/post.rb