Sha256: 13fea5911071177e6adebb7fd71be6d70023f5fe6c9e0e042eb0347f153a495c

Contents?: true

Size: 702 Bytes

Versions: 4

Compression:

Stored size: 702 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: 'PhcdevworksAccountsDevise::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

4 entries across 4 versions & 1 rubygems

Version Path
phcpresspro-87.0.3 app/models/phcpresspro/article/post.rb
phcpresspro-87.0.2 app/models/phcpresspro/article/post.rb
phcpresspro-87.0.1 app/models/phcpresspro/article/post.rb
phcpresspro-87.0.0 app/models/phcpresspro/article/post.rb