app/models/phcmembers/directory/category.rb in phcmembers-64.1.0 vs app/models/phcmembers/directory/category.rb in phcmembers-65.0.0
- old
+ new
@@ -1,27 +1,25 @@
module Phcmembers
class Directory::Category < ApplicationRecord
-
- # Clean URL Initialize
+
+ # Clean URL Initialize
extend FriendlyId
-
- # Paper_tail Initialize
+
+ # Paper Trail Initialize
has_paper_trail :class_name => 'Phcmembers::CategoryVersions'
-
- # Relationships
+
+ # Relationships
has_and_belongs_to_many :listings, class_name: 'Phcmembers::Member::Listing', :join_table => 'categories_listings', :dependent => :destroy
-
+
+ # Form Fields Validation
validates :category_name,
- length: { minimum: 3 }
-
- # Clean URL Define
- friendly_id :phcmembers_category_slug, use: [:slugged, :finders]
-
- # Define for Multiple Records
- def phcmembers_category_slug
- [
- :category_name
- ]
+ presence: true
+
+ # Clean URL Define
+ friendly_id :phc_nice_url_slug, use: [:slugged, :finders]
+
+ def phc_nice_url_slug
+ [:category_name]
end
-
+
end
end