Sha256: 3c1e65bf3c1a46692e6e7f0f87ef08bbc5bbdd34b4ce6e5cd1d28b8705a678f5

Contents?: true

Size: 649 Bytes

Versions: 5

Compression:

Stored size: 649 Bytes

Contents

module Phcpress
	class Article::Category < ApplicationRecord

		# Clean URL Initialize
		extend FriendlyId

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

		# Relationships
		has_and_belongs_to_many :posts, class_name: 'Phcpress::Article::Post', :join_table => 'categories_posts', :dependent => :destroy
		belongs_to :user, class_name: 'PhcdevworksAccountsDevise::User'

		# Form Fields Validation
		validates :category_name,
		presence: true,
		uniqueness: true

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

		def phc_nice_url_slug
			[:category_name]
		end

	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
phcpress-57.0.4 app/models/phcpress/article/category.rb
phcpress-57.0.3 app/models/phcpress/article/category.rb
phcpress-57.0.2 app/models/phcpress/article/category.rb
phcpress-57.0.1 app/models/phcpress/article/category.rb
phcpress-57.0.0 app/models/phcpress/article/category.rb