app/models/phcscriptcdn/script/listing.rb in phcscriptcdn-7.2.2 vs app/models/phcscriptcdn/script/listing.rb in phcscriptcdn-8.1.0
- old
+ new
@@ -1,21 +1,18 @@
module Phcscriptcdn
class Script::Listing < ApplicationRecord
- # Clean URLS
+ # Clean URL Initialize
extend FriendlyId
- # Attach to URL (Nested)
- has_many :urls, class_name: 'Phcscriptcdn::Script::Url'
+ # Add Paper Trail
+ has_paper_trail :class_name => 'Phcscriptcdn::ListingVersions'
- # Attach to Author (None Nested)
+ # Relationships
+ has_many :urls, class_name: 'Phcscriptcdn::Script::Url'
belongs_to :author, class_name: 'Phcscriptcdn::Script::Author'
-
- # Attach to Version (None Nested)
belongs_to :version, class_name: 'Phcscriptcdn::Script::Version'
-
- # Attach to Licence (None Nested)
belongs_to :licence, class_name: 'Phcscriptcdn::Script::Licence'
# Validation for Form Fields
validates :scripttitle,
presence: true
@@ -24,10 +21,17 @@
presence: true
validates :scriptstatus,
presence: true
- # Clean URLS Slugs
- friendly_id :scripttitle, use: :slugged
+ # Clean URL Define
+ friendly_id :phcscriptcdn_listing_slug, use: [:slugged, :finders]
+ # Define for Multiple Records
+ def phcscriptcdn_listing_slug
+ [
+ [:scripttitle]
+ ]
+ end
+
end
-end
\ No newline at end of file
+end