app/models/phcscriptcdnpro/script/author.rb in phcscriptcdnpro-73.1.0 vs app/models/phcscriptcdnpro/script/author.rb in phcscriptcdnpro-74.0.0
- old
+ new
@@ -2,23 +2,32 @@
class Script::Author < ApplicationRecord
# Clean URL Initialize
extend FriendlyId
- # Add Paper Trail
+ # Paper Trail Initialize
has_paper_trail :class_name => 'Phcscriptcdnpro::AuthorVersions'
# Relationships
has_many :listings, class_name: 'Phcscriptcdnpro::Script::Listing'
+ # Form Fields Validation
+ validates :author_first_name,
+ presence: true
+
+ validates :author_website,
+ presence: true,
+ format: { with: URI::regexp(%w(http https)), message: "Please follow this URL format http or https://www.**********.com" }
+
+ validates :author_github,
+ presence: true,
+ format: { with: URI::regexp(%w(http https)), message: "Please follow this URL format http or https://www.**********.com" }
+
# Clean URL Define
- friendly_id :phcscriptcdnpro_author_slug, use: [:slugged, :finders]
+ friendly_id :phc_nice_url_slug, use: [:slugged, :finders]
- # Define for Multiple Records
- def phcscriptcdnpro_author_slug
- [
- [:author_first_name, :author_last_name]
- ]
+ def phc_nice_url_slug
+ [:author_first_name, :author_last_name]
end
end
end