Sha256: 2f8da590c0a330652129e92cc268b5f97139b31fae8e88e8b3b3eb7d751fec7c
Contents?: true
Size: 775 Bytes
Versions: 2
Compression:
Stored size: 775 Bytes
Contents
module PhcdevworksTutorials class Tutorial::Post < ApplicationRecord # Clean URL Initialize extend FriendlyId # Image Upload has_one_attached :post_image # Relationships has_and_belongs_to_many :categories, class_name: "Tutorial::Category", :join_table => "phcdevworks_tutorials_categories_posts", :dependent => :destroy has_many :steps, class_name: "Tutorial::Step" belongs_to :user, class_name: "PhcdevworksAccounts::User" # Form Fields Validation validates :post_title, presence: true validates :post_description, presence: true # Clean URL Define friendly_id :phcdev_tutorial_post_nice_urls, use: [:slugged, :finders] def phcdev_tutorial_post_nice_urls [:post_title] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
phcdevworks_tutorials-4.0.1 | app/models/phcdevworks_tutorials/tutorial/post.rb |
phcdevworks_tutorials-4.0.0 | app/models/phcdevworks_tutorials/tutorial/post.rb |